I have a list of questions with a list of multiple choice answers.
I am trying to get details of a user who will then answer the questions and store their answers next to their name. The questions/answers may change moving forward.
I have the following code is this correct can you help please?
I am trying to get details of a user who will then answer the questions and store their answers next to their name. The questions/answers may change moving forward.
I have the following code is this correct can you help please?
from django.db import models class Investor(models.Model): Investor = models.CharField(max_length=100, default="") def __str__(self): return self.Investor class Question(models.Model): Question_text = models.TextField(max_length=200,default="") def __str__(self): return self.Question_text class Option(models.Model): Question = models.ForeignKey(Question, on_delete=models.CASCADE) Option = models.CharField(max_length=50, default="") def __str__(self): return self.Option class Answer(models.Model): Investor = models.ForeignKey(Investor, on_delete=models.CASCADE, default="") Question = models.OneToOneField( Question, on_delete=models.CASCADE, primary_key=True, ) Answer = models.OneToOneField( Option, on_delete=models.CASCADE, primary_key=True, )