X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/30c59c96869c9996540f1cf844dadd38d00ab8f3..3d786c6d8c1bd3685ac328c7f4b811c13ea60e1a:/philo/contrib/penfield/models.py?ds=inline diff --git a/philo/contrib/penfield/models.py b/philo/contrib/penfield/models.py index b8ca610..3632ff6 100644 --- a/philo/contrib/penfield/models.py +++ b/philo/contrib/penfield/models.py @@ -51,9 +51,9 @@ class FeedView(MultiView): #: A :class:`PositiveIntegerField` - the maximum number of items to return for this feed. All items will be returned if this field is blank. Default: 15. 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.") - #: A :class:`ForeignKey` to a :class:`.Template` which can be used to render the title of each item in the feed. + #: A :class:`ForeignKey` to a :class:`.Template` which will be used to render the title of each item in the feed if provided. item_title_template = models.ForeignKey(Template, blank=True, null=True, related_name="%(app_label)s_%(class)s_title_related") - #: A :class:`ForeignKey` to a :class:`.Template` which can be used to render the description of each item in the feed. + #: A :class:`ForeignKey` to a :class:`.Template` which will be used to render the description of each item in the feed if provided. item_description_template = models.ForeignKey(Template, blank=True, null=True, related_name="%(app_label)s_%(class)s_description_related") #: The name of the context variable to be populated with the items managed by the :class:`FeedView`. @@ -201,7 +201,7 @@ class FeedView(MultiView): language = settings.LANGUAGE_CODE.decode(), feed_url = add_domain( current_site.domain, - self.__get_dynamic_attr('feed_url', obj) or node.construct_url(node.subpath, with_domain=True, request=request, secure=request.is_secure()), + self.__get_dynamic_attr('feed_url', obj) or node.construct_url(node._subpath, with_domain=True, request=request, secure=request.is_secure()), request.is_secure() ), author_name = self.__get_dynamic_attr('author_name', obj), @@ -471,7 +471,7 @@ class BlogView(FeedView): @property def urlpatterns(self): urlpatterns = self.feed_patterns(r'^', 'get_all_entries', 'index_page', 'index') +\ - self.feed_patterns(r'^%s/(?P[-\w]+[-+/\w]*)$' % self.tag_permalink_base, 'get_entries_by_tag', 'tag_page', 'entries_by_tag') + self.feed_patterns(r'^%s/(?P[-\w]+[-+/\w]*)' % self.tag_permalink_base, 'get_entries_by_tag', 'tag_page', 'entries_by_tag') if self.tag_archive_page: urlpatterns += patterns('', @@ -512,8 +512,8 @@ class BlogView(FeedView): return {'blog': self.blog} def get_entry_queryset(self): - """Returns the default :class:`QuerySet` of :class:`BlogEntry` instances for the :class:`BlogView`.""" - return self.blog.entries.all() + """Returns the default :class:`QuerySet` of :class:`BlogEntry` instances for the :class:`BlogView` - all entries that are considered posted in the past. This allows for scheduled posting of entries.""" + return self.blog.entries.filter(date__lte=datetime.now()) def get_tag_queryset(self): """Returns the default :class:`QuerySet` of :class:`.Tag`\ s for the :class:`BlogView`'s :meth:`get_entries_by_tag` and :meth:`tag_archive_view`.""" @@ -831,8 +831,8 @@ class NewsletterView(FeedView): return {'newsletter': self.newsletter} def get_article_queryset(self): - """Returns the default :class:`QuerySet` of :class:`NewsletterArticle` instances for the :class:`NewsletterView`.""" - return self.newsletter.articles.all() + """Returns the default :class:`QuerySet` of :class:`NewsletterArticle` instances for the :class:`NewsletterView` - all articles that are considered posted in the past. This allows for scheduled posting of articles.""" + return self.newsletter.articles.filter(date__lte=datetime.now()) def get_issue_queryset(self): """Returns the default :class:`QuerySet` of :class:`NewsletterIssue` instances for the :class:`NewsletterView`."""