<s> from __future__ import unicode_literals <EOL> from django . db import models <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from django . conf import settings <EOL> from django . utils import timezone <EOL> class TopicPoll ( models . Model ) : <EOL> topic = models . OneToOneField ( '<STR_LIT>' , verbose_name = _ ( "<STR_LIT>" ) , primary_key = True , related_name = '<STR_LIT>' ) <EOL> date = models . DateTimeField ( default = timezone . now ) <EOL> choice_limit = models . PositiveIntegerField ( _ ( "<STR_LIT>" ) , default = <NUM_LIT:1> ) <EOL> is_closed = models . BooleanField ( default = False ) <EOL> class Meta : <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> def get_absolute_url ( self ) : <EOL> return self . topic . get_absolute_url ( ) <EOL> @ property <EOL> def is_multiple_choice ( self ) : <EOL> return self . choice_limit > <NUM_LIT:1> <EOL> class TopicPollChoice ( models . Model ) : <EOL> poll = models . ForeignKey ( TopicPoll , verbose_name = _ ( "<STR_LIT>" ) , related_name = '<STR_LIT>' ) <EOL> description = models . CharField ( _ ( "<STR_LIT>" ) , max_length = <NUM_LIT:255> ) <EOL> vote_count = models . PositiveIntegerField ( _ ( "<STR_LIT>" ) , default = <NUM_LIT:0> ) <EOL> class Meta : <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> class TopicPollVote ( models . Model ) : <EOL> choice = models . ForeignKey ( TopicPollChoice , verbose_name = _ ( "<STR_LIT>" ) , related_name = '<STR_LIT>' ) <EOL> user = models . ForeignKey ( settings . AUTH_USER_MODEL , related_name = '<STR_LIT>' ) <EOL> date = models . DateTimeField ( default = timezone . now ) <EOL> class Meta : <EOL> unique_together = ( '<STR_LIT:user>' , '<STR_LIT>' ) <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) </s>
