Commits

Sergey Generalov  committed 706327d

remove excerpt field, added new template filter: textcut

  • Participants
  • Parent commits 3edab54

Comments (0)

Files changed (2)

File cmsplugin_news/models.py

     title           = models.CharField(_('Title'), max_length=255)
     slug            = models.SlugField(_('Slug'), unique_for_date='pub_date', 
                         help_text=_('A slug is a short name which uniquely identifies the news item for this day'))
-    excerpt         = models.TextField(_('Excerpt'), blank=True)
     content         = models.TextField(_('Content'), blank=True)
     
     is_published    = models.BooleanField(_('Published'), default=False)

File cmsplugin_news/templatetags/cms_news_tags.py

 from django import template
+from django.utils.safestring import mark_safe
 from cmsplugin_news.models import News
-import settings
+from django.conf import settings
 
 register = template.Library()
 
         raise template.TemplateSyntaxError, "Second argument to '%s' tag must be 'as'" % tokens[0]
     return LastNewsNode(tokens[3], tokens[1])
 last_news = register.tag(last_news)
+
+@register.filter
+def textcut(text, autoescape=None):
+    try:
+        beforesep, aftersep, sep = text.partition('<!-- pagebreak -->')
+    except:
+        beforesep = text
+    return mark_safe(beforesep)