While working on my django view, I encountered an error stating: ValueError: Cannot assign '827': 'Course_Content.course_outline_id' must be a 'Course_Outline' instance. I attempted to convert it to an int but it still didn't resolve the issue. Even using outline_instance.id did not work as expected.
views.py
class UpdateCourseOutline(View):
def post(self, request):
# Logic for updating course outline and content
models.py
class Course_Outline(models.Model):
syllabus_ai_id = models.ForeignKey(Syllabus_AI, on_delete=models.CASCADE, null=True)
week = models.CharField(max_length=100, blank=True, null=True)
topic = models.TextField(blank=True, null=True)
course_learning_outcomes = models.CharField(max_length=50, blank=True, null=True)
class Course_Content(models.Model):
course_outline_id = models.ForeignKey(Course_Outline, on_delete=models.CASCADE)
course_content = models.TextField()