authors = models.ManyToManyField( User, blank = True, ) def _get_permalink_for_page(self, page): """Returns the URL of this article for the given news feed page.""" return page.reverse("article_detail", kwargs={ "year": self.date.year, "month": self.date.strftime("%b").lower(), "day": self.date.day, "url_title": self.url_title, }) def get_absolute_url(self): """Returns the URL of the article.""" return self._get_permalink_for_page(self.news_feed.page) class Meta: unique_together = (("news_feed", "date", "url_title",),) ordering = ("-date",) externals.historylinks("register", Article) sitemaps.register(Article) externals.watson("register", Article, adapter_cls=PageBaseSearchAdapter)
)) def get_live_queryset(self): """Selects the live page queryset.""" # HACK: Prevents a table name collision in the Django queryset manager. with publication_manager.select_published(False): qs = Page._base_manager.all() if publication_manager.select_published_active(): qs = Page.objects.select_published(qs, page_alias="U0") # Filter out unindexable pages. qs = filter_indexable_pages(qs) # All done! return qs externals.watson("register", Page, adapter_cls=PageSearchAdapter) # Base content class. def get_registered_content(): """Returns a list of all registered content objects.""" return [ model for model in apps.get_models() if issubclass(model, ContentBase) and not model._meta.abstract ] def filter_indexable_pages(queryset): """ Filters the given queryset of pages to only contain ones that should be
models.TextField))))))) def get_live_queryset(self): """Selects the live page queryset.""" # HACK: Prevents a table name collision in the Django queryset manager. with publication_manager.select_published(False): qs = Page._base_manager.all() if publication_manager.select_published_active(): qs = Page.objects.select_published(qs, page_alias="U0") # Filter out unindexable pages. qs = filter_indexable_pages(qs) # All done! return qs externals.watson("register", Page, adapter_cls=PageSearchAdapter) # Base content class. def get_registered_content(): """Returns a list of all registered content objects.""" return [ model for model in apps.get_models() if issubclass(model, ContentBase) and not model._meta.abstract ] def filter_indexable_pages(queryset): """ Filters the given queryset of pages to only contain ones that should be
) def _get_permalink_for_page(self, page): """Returns the URL of this article for the given news feed page.""" return page.reverse("article_detail", kwargs={ "year": self.date.year, "month": self.date.strftime("%b").lower(), "day": self.date.day, "url_title": self.url_title, }) def get_absolute_url(self): """Returns the URL of the article.""" return self._get_permalink_for_page(self.news_feed.page) class Meta: unique_together = (( "news_feed", "date", "url_title", ), ) ordering = ("-date", ) externals.historylinks("register", Article) sitemaps.register(Article) externals.watson("register", Article, adapter_cls=PageBaseSearchAdapter)