<s> from django import forms <EOL> from hackday . voting . moremodels import Category , TYPE <EOL> from hackday . teams . models import Team , STATUS , PROJECT_TYPE <EOL> class VoteForm ( forms . Form ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( VoteForm , self ) . __init__ ( * args , ** kwargs ) <EOL> categories = Category . objects . filter ( type = TYPE . VOTED ) . order_by ( "<STR_LIT:name>" ) <EOL> for c in categories : <EOL> if c . is_concept : <EOL> queryset = Team . objects . filter ( status = STATUS . ACTIVE , <EOL> project_type = PROJECT_TYPE . CONCEPT ) . order_by ( "<STR_LIT:name>" ) <EOL> elif c . is_implemented : <EOL> queryset = Team . objects . filter ( status = STATUS . ACTIVE , <EOL> project_type = PROJECT_TYPE . IMPLEMENTED ) . order_by ( "<STR_LIT:name>" ) <EOL> else : <EOL> queryset = Team . objects . filter ( status = STATUS . ACTIVE ) . order_by ( "<STR_LIT:name>" ) <EOL> self . fields [ '<STR_LIT>' % c . id ] = forms . ModelChoiceField ( <EOL> queryset = queryset , <EOL> label = c . name , <EOL> empty_label = "<STR_LIT>" , <EOL> required = False ) <EOL> class AuthorizeForm ( forms . Form ) : <EOL> user_name = forms . CharField ( label = '<STR_LIT>' , ) <EOL> password = forms . CharField ( label = '<STR_LIT>' , widget = forms . PasswordInput , ) <EOL> class VoteAuthorizeForm ( forms . Form ) : <EOL> user_name = forms . CharField ( label = '<STR_LIT>' , widget = forms . TextInput ( attrs = { '<STR_LIT>' : '<STR_LIT>' } ) ) <EOL> password = forms . CharField ( label = '<STR_LIT>' , widget = forms . PasswordInput , ) <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( VoteAuthorizeForm , self ) . __init__ ( * args , ** kwargs ) <EOL> categories = Category . objects . filter ( type = TYPE . VOTED ) . order_by ( "<STR_LIT:name>" ) <EOL> for c in categories : <EOL> if c . is_concept : <EOL> queryset = Team . objects . filter ( status = STATUS . ACTIVE , <EOL> project_type = PROJECT_TYPE . CONCEPT ) . order_by ( "<STR_LIT:name>" ) <EOL> elif c . is_implemented : <EOL> queryset = Team . objects . filter ( status = STATUS . ACTIVE , <EOL> project_type = PROJECT_TYPE . IMPLEMENTED ) . order_by ( "<STR_LIT:name>" ) <EOL> else : <EOL> queryset = Team . objects . filter ( status = STATUS . ACTIVE ) . order_by ( "<STR_LIT:name>" ) <EOL> self . fields [ '<STR_LIT>' % c . id ] = forms . ModelChoiceField ( <EOL> queryset = queryset , <EOL> label = c . name , <EOL> empty_label = "<STR_LIT>" , <EOL> required = False ) </s>
