Answer the question
In order to leave comments, you need to log in
How to get current user in model method?
In template:{{test_question.get_true_user_quest}}
class Test_question(models.Model):
test = models.ForeignKey(Tests)
question = models.ForeignKey(Question)
def get_true_user_quest(self):
user = ????
#получить ответы конкретного пользователя на данный вопрос (из Test_questuon) в контексте текущего теста
answer_user_all_in_question_in_test=self.test.user_answer_set.filter(question_id=self.question.id, user=user)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question