A
A
Alexander2014-04-14 17:10:21
Django
Alexander, 2014-04-14 17:10:21

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

1 answer(s)
S
SilentSokolov, 2014-04-14
@ROR191505

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 question

Ask a Question

731 491 924 answers to any question