I will assume user can vote a specific article. I would go for another
model, like that

class VoteForArticle(models.Model):
    DOWN = 0
    NEUTRAL = 1
    UP = 2
    VOTES = ((DOWN, "down"), (NEUTRAL, "neutral)", (UP, "up"))
    user = models.ForeignKey(settings.AUTH_USER_MODEL)
    article = models.ForeignKey("Article")
    vote = models.IntegerField(choices=VOTES)

If you are concerned with space, use a models.CharField with max_length = 1

2016-06-06 18:35 GMT+02:00 Avraham Serour <tovm...@gmail.com>:

> Maybe a nullable boolean field
> On Jun 6, 2016 6:27 PM, "Robin Lery" <robinl...@gmail.com> wrote:
>
>> Hello,
>> I have made an app to create article. This is the model:
>>
>> class Article(models.Model):
>>     user = models.ForeignKey(settings.AUTH_USER_MODEL)
>>     title = models.CharField(max_length=150)
>>     body = models.TextField()
>>     pub_date = models.DateTimeField(default=timezone.now)
>>     tags = models.ManyToManyField(Tag)
>>     article_image = models.ImageField(upload_to=get_upload_file_name,
>> blank=True)
>>
>> Here I want to setup a voting system for each app. There I would the user
>> to vote up, or vote down, or do nothing. Boolean field would have been
>> great, but since an article can have 3 choices of votes  (vote up / vote
>> down / no vote ), how should I go about doing this? Your help and guidance
>> will be very much appreciated.
>>
>> Thank you.
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>  Virus-free.
>> www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>> <#m_387066654494763674_m_1256279215608716353_DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2B4-nGo-pNLjsEoE5bVT%3DaGxcJGcCm9nvx%2Bqjj8J6rT2J%3Dgq%3DQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2B4-nGo-pNLjsEoE5bVT%3DaGxcJGcCm9nvx%2Bqjj8J6rT2J%3Dgq%3DQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWa6t%2BP5jGVHKW1zuDaV9GqfDWBz3Vx8ChSHHSkt3bf1hACQA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWa6t%2BP5jGVHKW1zuDaV9GqfDWBz3Vx8ChSHHSkt3bf1hACQA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTbgn8oijRhKBdm%3DC%3Di%3D_%3DnUYX_Yt98jQgE0igyMBoFadA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to