Mercurial > agora-palash
diff apps/snippet/models.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 | 8ef0a2a03034 |
children | 365144dad9d1 |
line wrap: on
line diff
--- a/apps/snippet/models.py Fri Aug 31 02:26:22 2012 -0400 +++ b/apps/snippet/models.py Fri Aug 31 02:28:57 2012 -0400 @@ -20,7 +20,10 @@ content = models.TextField(_(u'Content'), ) content_highlighted = models.TextField(_(u'Highlighted Content'), blank=True) - lexer = models.CharField(_(u'Lexer'), max_length=30, default=LEXER_DEFAULT) + lexer = models.CharField(_(u'Lexer'), + max_length=30, + choices=LEXER_LIST, + default=LEXER_DEFAULT) published = models.DateTimeField(_(u'Published'), blank=True) expires = models.DateTimeField(_(u'Expires'), blank=True, help_text='asdf') parent = models.ForeignKey('self', null=True, blank=True,