Commits

Dmitriy Budashny committed e6b5130

Added 'summary' field for news article.

  • Participants
  • Parent commits 706327d

Comments (0)

Files changed (3)

cmsplugin_news/forms.py

         super(NewsForm, self).__init__(*args, **kwargs)
         widget = self._get_widget()
         self.fields['content'].widget = widget
+        self.fields['summary'].widget = widget
         

cmsplugin_news/models.py

     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'))
     content         = models.TextField(_('Content'), blank=True)
+    summary         = models.TextField(_('Summary'), blank=True,
+                        help_text=_('A brief summary of the news article'))
     
     is_published    = models.BooleanField(_('Published'), default=False)
     pub_date        = models.DateTimeField(_('Publication date'), default=datetime.datetime.now())

cmsplugin_news/templates/cmsplugin_news/news_archive.html

 <h1>Latest news</h1>
 
 {% for object in latest %}
-	<p><strong>{{ object.title }}</strong><br/><a href="{{ object.get_absolute_url }}">Read more</a></p>
-{% endfor %}
+	<p><strong>{{ object.title }}</strong><br/>
+          {{ object.summary|safe }}<br/>
+          <a href="{{ object.get_absolute_url }}">Read more</a></p>
+{% endfor %}