MARKUP_LANG_CHOICES = (
    ('markdown', 'Markdown'),
    ('textile', 'Textile'),
    ('none', 'None'),
)

class Entry(models.Model):
    markup_lang = models.CharField('Markup Language', maxlength=255, choices=MARKUP_LANG_CHOICES, default='markdown')
    body = models.TextField(help_text='Use selected markup.')
    body_html = models.TextField('Body as HTML', blank=True, null=True)

    def save(self):
        if self.markup_lang == 'markdown':
	    import markdown
	    self.body_html = markdown.markdown(self.body)
	if self.markup_lang == 'textile':
	    import textile
	    self.body_html = textile.textile(self.body)
	if self.markup_lang == 'none':
	    self.body_html = self.body
	super(Entry, self).save()