comparison apps/snippet/forms.py @ 99:d858aae811d0

Move choices for lexer field from SnippetForm to Snippet The choices should be on the model, because it's more logical and because now we can print out the human-readable value of the field directly from the model, using snippet.get_FIELD_display() (e.g. get_lexer_display()).
author dellsystem <ilostwaldo@gmail.com>
date Fri, 31 Aug 2012 02:28:57 -0400
parents 5a8f1dece263
children ba51d3b7740b
comparison
equal deleted inserted replaced
98:5a8f1dece263 99:d858aae811d0
18 18
19 EXPIRE_DEFAULT = 3600*24*30 19 EXPIRE_DEFAULT = 3600*24*30
20 20
21 class SnippetForm(forms.ModelForm): 21 class SnippetForm(forms.ModelForm):
22 22
23 lexer = forms.ChoiceField(
24 choices=LEXER_LIST,
25 initial=LEXER_DEFAULT,
26 label=_(u'Lexer'),
27 )
28 expire_options = forms.ChoiceField( 23 expire_options = forms.ChoiceField(
29 choices=EXPIRE_CHOICES, 24 choices=EXPIRE_CHOICES,
30 initial=EXPIRE_DEFAULT, 25 initial=EXPIRE_DEFAULT,
31 label=_(u'Expires'), 26 label=_(u'Expires'),
32 ) 27 )