2👍
These two lines are suspect:
Professor.objects.get(name=professor).question = question_instance
Professor.objects.get(name=professor).save()
The second line will get the Professor from the database again, and it won’t have your question instance attached anymore when you save it. Try this instead:
prof = Professor.objects.get(name=professor)
prof.question = question_instance
prof.save()
👤Ben
Source:stackexchange.com