<s> from django . db import models <EOL> from django . utils . translation import ugettext as _ <EOL> class CandidateList ( models . Model ) : <EOL> candidates = models . ManyToManyField ( '<STR_LIT>' , blank = True , null = True , through = '<STR_LIT>' ) <EOL> name = models . CharField ( _ ( '<STR_LIT:Name>' ) , max_length = <NUM_LIT> ) <EOL> ballot = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:4> ) <EOL> number_of_seats = models . IntegerField ( blank = True , null = True ) <EOL> surplus_partner = models . ForeignKey ( '<STR_LIT>' , blank = True , null = True , <EOL> help_text = _ ( '<STR_LIT>' ) ) <EOL> mpg_html_report = models . TextField ( _ ( '<STR_LIT>' ) , blank = True , null = True , <EOL> help_text = _ ( '<STR_LIT>' ) ) <EOL> img_url = models . URLField ( blank = True ) <EOL> youtube_user = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT> , null = True , blank = True ) <EOL> wikipedia_page = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT> , null = True , blank = True ) <EOL> twitter_account = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT> , null = True , blank = True ) <EOL> facebook_url = models . URLField ( blank = True , null = True ) <EOL> platform = models . TextField ( _ ( '<STR_LIT>' ) , blank = True , null = True ) <EOL> def save ( self , * args , ** kwargs ) : <EOL> super ( CandidateList , self ) . save ( ) <EOL> if self . surplus_partner : <EOL> self . surplus_partner . surplus_partner = self <EOL> def getHeadName ( self ) : <EOL> return Candidate . objects . get ( candidates_list = self , ordinal = <NUM_LIT:1> ) . person . name <EOL> @ property <EOL> def member_ids ( self ) : <EOL> '''<STR_LIT>''' <EOL> mks = Candidate . objects . filter ( candidates_list = self , person__mk__isnull = False ) <EOL> return mks . values_list ( '<STR_LIT>' , flat = True ) <EOL> @ models . permalink <EOL> def get_absolute_url ( self ) : <EOL> return ( '<STR_LIT>' , [ self . id ] ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Party ( models . Model ) : <EOL> name = models . CharField ( max_length = <NUM_LIT:64> ) <EOL> accepts_memberships = models . BooleanField ( default = True ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Meta : <EOL> verbose_name_plural = '<STR_LIT>' <EOL> class Candidate ( models . Model ) : <EOL> candidates_list = models . ForeignKey ( CandidateList ) <EOL> person = models . ForeignKey ( '<STR_LIT>' ) <EOL> ordinal = models . IntegerField ( _ ( '<STR_LIT>' ) ) <EOL> party = models . ForeignKey ( Party , blank = True , null = True ) <EOL> votes = models . IntegerField ( _ ( '<STR_LIT>' ) , null = True , blank = True , help_text = _ ( '<STR_LIT>' ) ) <EOL> class Meta : <EOL> ordering = ( '<STR_LIT>' , ) <EOL> def __unicode__ ( self ) : <EOL> return self . person . name </s>
