예제 #1
0
 def get_object(self, request, slug):
     User = get_user_model()
     return get_object_or_404(User, username=slug)
예제 #2
0
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sitemaps import Sitemap
from django.utils.translation import get_language
from fluent_blogs import appsettings
from fluent_blogs.models import get_entry_model, get_category_model
from fluent_blogs.urlresolvers import blog_reverse
from fluent_blogs.utils.compat import get_user_model
from parler.models import TranslatableModel

User = get_user_model()
EntryModel = get_entry_model()
CategoryModel = get_category_model()


class EntrySitemap(Sitemap):
    """
    The sitemap definition for the pages created with django-fluent-blogs.
    """
    def items(self):
        qs = EntryModel.objects.published().order_by('-publication_date')

        if issubclass(EntryModel, TranslatableModel):
            # Note that .active_translations() can't be combined with other filters for translations__.. fields.
            qs = qs.active_translations()
            return qs.order_by('-publication_date', 'translations__language_code')
        else:
            return qs.order_by('-publication_date')


    def lastmod(self, urlnode):
예제 #3
0
 def get_queryset(self):
     self.author = get_object_or_404(get_user_model(), username=self.kwargs['slug'])
     return super(EntryAuthorArchive, self).get_queryset().filter(author=self.author)
예제 #4
0
 def get_object(self, request, slug):
     User = get_user_model()
     return get_object_or_404(User, username=slug)