From 8346482d47f98be745466087b0bd5dc954f46cf4 Mon Sep 17 00:00:00 2001 From: holyantony Date: Tue, 14 Jul 2015 16:45:10 +0530 Subject: Subject: Voting Validation(Questions) Description: 1. User cannot vote his/her own question --- website/models.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'website/models.py') diff --git a/website/models.py b/website/models.py index b15f1cd..b195f3f 100644 --- a/website/models.py +++ b/website/models.py @@ -31,8 +31,12 @@ class Question(models.Model): userUpVotes = models.ManyToManyField(User, blank=True, related_name='postUpVotes') userDownVotes = models.ManyToManyField(User, blank=True, related_name='postDownVotes') num_votes = models.IntegerField(default=0) + + def __unicode__(self): return '%s' % (self.user) + + class Meta: get_latest_by = "date_created" -- cgit