I have these models
class User(models.Model):
user_name = models.CharField()
ph_number = models.CharField()
class ExamPaper(models.Model):
paper_name = models.CharField()
paper_subject = models.CharField()
class Questions(models.Model):
paper = models.ManyToManyField(ExamPaper,
related_name='question_set')
question_num = models.IntegerField()
question_text = models.TextField()
Now I want to store the results of each question by each user for each
paper. Paper will have multiple questions and a question may also
belong to multiple papers. User may give multiple papers and multiple
questions.
I want mysql table to have user, paper and question to define primary
key taken all together and two more fields 'marks' and 'result'. I'm
not able to understand how to do this in django models. Will this
work:
class Result(models.Model):
user = models.ManyToManyField(User)
paper = models.ManyToManyField(ExamPaper)
question = models.ManyToManyField(Question)
marks = models.IntegerField()
result = models.CharField()
Please anyone can anyone explain?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.