X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/ac4596780e153ed1d9e46c98a2179eaeed7b034e..90bcb8a34f4fcfc52b21da7c82430f06524318b8:/contrib/penfield/models.py?ds=sidebyside diff --git a/contrib/penfield/models.py b/contrib/penfield/models.py index b970643..a03bed8 100644 --- a/contrib/penfield/models.py +++ b/contrib/penfield/models.py @@ -46,6 +46,7 @@ class FeedView(MultiView): feed_type = models.CharField(max_length=50, choices=FEED_CHOICES, default=ATOM) feed_suffix = models.CharField(max_length=255, blank=False, default="feed") feeds_enabled = models.BooleanField(default=True) + feed_length = models.PositiveIntegerField(blank=True, null=True, default=15, help_text="The maximum number of items to return for this feed. All items will be returned if this field is blank.") item_title_template = models.ForeignKey(Template, blank=True, null=True, related_name="%(app_label)s_%(class)s_title_related") item_description_template = models.ForeignKey(Template, blank=True, null=True, related_name="%(app_label)s_%(class)s_description_related") @@ -195,6 +196,9 @@ class FeedView(MultiView): except Site.DoesNotExist: current_site = RequestSite(request) + if self.feed_length is not None: + items = items[:self.feed_length] + for item in items: if title_template is not None: title = title_template.render(RequestContext(request, {'obj': item}))