Answer the question
In order to leave comments, you need to log in
How to save a list of users who voted in a poll?
We need to have something like an array that will store the user who voted in the poll. How can this be done?
#models.py
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
description = models.CharField(max_length=500, default='', blank = True)
phone = models.IntegerField(default=0, blank = True)
image = models.ImageField(upload_to=avatar_upload_to, blank = True)
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField()
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
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