Highlight on request.

This commit is contained in:
Martin Mahner 2011-06-10 14:26:02 +02:00
parent 2fd5c0e4e8
commit 50ca0e2234

View file

@ -18,7 +18,6 @@ class Snippet(models.Model):
title = models.CharField(_(u'Title'), max_length=120, blank=True) title = models.CharField(_(u'Title'), max_length=120, blank=True)
author = models.CharField(_(u'Author'), max_length=30, blank=True) author = models.CharField(_(u'Author'), max_length=30, blank=True)
content = models.TextField(_(u'Content'), ) 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, default=LEXER_DEFAULT)
published = models.DateTimeField(_(u'Published'), blank=True) published = models.DateTimeField(_(u'Published'), blank=True)
expires = models.DateTimeField(_(u'Expires'), blank=True, help_text='asdf') expires = models.DateTimeField(_(u'Expires'), blank=True, help_text='asdf')
@ -31,14 +30,12 @@ class Snippet(models.Model):
return len(self.content.splitlines()) return len(self.content.splitlines())
def content_splitted(self): def content_splitted(self):
return self.content_highlighted.splitlines() return self.content.splitlines()
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.pk: if not self.pk:
self.published = datetime.datetime.now() self.published = datetime.datetime.now()
self.secret_id = generate_secret_id() self.secret_id = generate_secret_id()
#self.content_highlighted = pygmentize(self.content, self.lexer)
self.content_highlighted = self.content
super(Snippet, self).save(*args, **kwargs) super(Snippet, self).save(*args, **kwargs)
def get_absolute_url(self): def get_absolute_url(self):