1. Bernardo Cabezas Serra
  2. cmsplugin-advancednews

Commits

aaloy  committed fa60f5f

typo in help

  • Participants
  • Parent commits 3a4d4c2
  • Branches default

Comments (0)

Files changed (1)

File cmsplugin_advancednews/models.py

View file
  • Ignore whitespace
+#!/usr/bin/env python
+# encoding: utf-8
+# ----------------------------------------------------------------------------
+
 import datetime
 
 from django.db import models
 
 
 class PublishedNewsManager(TranslationManager):
-    """ Filters out all unpublished and items with a publication date in the future. """
+    """
+    Filters out all unpublished and items with a publication date
+    in the future.
+    """
 
     def get_query_set(self):
-        return super(PublishedNewsManager, self).get_query_set().filter(is_published=True).filter(pub_date__lte=datetime.datetime.now())
+        return super(PublishedNewsManager, self).get_query_set().filter(
+                is_published=True).filter(
+                        pub_date__lte=datetime.datetime.now())
 
 
 class News(TranslatableModel):
 
     slug = models.SlugField(_('Slug'), unique_for_date='pub_date',
             help_text=_('Name in lowercase with no spaces which will be chown in the URL of the navigator'))
-
     category = models.ForeignKey("Category", related_name="n_category",
                         null=True, blank=True, default=None)
-
     is_published = models.BooleanField(_('Published'), default=False)
     pub_date = models.DateTimeField(_('Publication date'),
             default=datetime.datetime.now())
-
     created = models.DateTimeField(auto_now_add=True, editable=False)
     updated = models.DateTimeField(auto_now=True, editable=False)
     content = PlaceholderField('content',
             verbose_name=_('Full news body'),
             help_text=_('Full content that will be shown in the body of the news item \
                     <br/><b>Quick note</b>: To add text content: \
-                    <br/>Select Available Plutins > Text > Add a plugin'))
-
+                    <br/>Select Available Plugins > Text > Add a plugin'))
     translations = TranslatedFields(
         title=models.CharField(verbose_name=_('Title'), max_length=255,
             help_text=_('Title of the news item')),
             help_text=_('Short exceprt of the new item. Will be shown on the news list.'))
     )
 
-    
+    objects = TranslationManager()
     published = PublishedNewsManager()
-    objects = TranslationManager()
 
-    
     class Meta:
         verbose_name = _('News')
         verbose_name_plural = _('News')
         ordering = ('-pub_date', )
 
-
     def __unicode__(self):
         return self.lazy_translation_getter('title', 'New: %s' % self.id)
-            
-        
-
-
 
     def get_absolute_url(self):
         return reverse('news_detail', kwargs={
             'slug': self.slug,
             })
 
+
 class Category(TranslatableModel):
     """
     Category
         title = models.CharField(_('Title'), max_length=255),
     )
 
-    
     class Meta:
         verbose_name = _('Category')
         verbose_name_plural = _('Categories')
         ordering = ('-pub_date', )
 
-    
-    def __unicode__(self):        
+    def __unicode__(self):
         return self.lazy_translation_getter('title', 'Category: %s' % self.id)
 
 
 class LatestAdvancedNewsPlugin(CMSPlugin):
-    """ Model for the settings when using the latest news cms plugin. """
+    """
+    Model for the settings when using the latest news cms plugin.
+    """
 
-    
     category = models.ForeignKey(Category, null=True, blank=True, default=None)
     limit = models.PositiveIntegerField(_('Number of news items to show'),
                                         help_text=_('Limits the number of items that will be displayed'))