X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/c5b8f054b58f98e9ebf0d686ad49e26fb6055d2a..43595c8f3220d11f47554e9755f5b54e283f635e:/contrib/penfield/models.py 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}))