Answer the question
In order to leave comments, you need to log in
An object of one model as part of another in Django?
There are two models. Users are stored in one, and questions and a decision flag for questions are stored in the other. How to make it so that each user has his own flag of decision?
class questions(models.Model):
task = models.CharField(max_length=100)
passed = models.BooleanField(default=False)
class user(models.Model):
name = models.CharField(max_length=100)
Answer the question
In order to leave comments, you need to log in
It is possible through one more table (id, user_id, questions_id, passed), which is logical. If speed is important, then look aside, for example, Redis, and already store the flag there.
PS The topic is very similar to "read / unread comments", look at the code on Google, perhaps the right solution will come to mind exactly for your option.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question