<commit_before>from django.views.generic.dates import ArchiveIndexView, YearArchiveView
from django.views.generic import DetailView


class GetQuerysetMixin(object):

    def get_queryset(self):
        if self.request.user.is_authenticated() and self.request.user.is_staff:
            return self.model.objects.all()
        return self.model.objects.live()


class MininewsArchiveIndexView(GetQuerysetMixin, ArchiveIndexView):
    model = None
    date_field = 'start'
    paginate_by = 20
    # Display page even if no content; this is convenience as in practice the
    # landing page for a blog will be in the main site menu, and it's not nice
    # for that to lead to a 404.
    allow_empty = True


class MininewsYearArchiveView(GetQuerysetMixin, YearArchiveView):
    model = None
    date_field = 'start'
    paginate_by = 20<commit_msg>Play nice with other apps.<commit_after>from django.views.generic.dates import ArchiveIndexView, YearArchiveView
from django.views.generic import DetailView


class GetQuerysetMixin(object):

    def get_queryset(self):
        qs = super(GetQuerysetMixin, self).get_queryset()
        if self.request.user.is_authenticated() and self.request.user.is_staff:
            return qs
        return qs.live()


class MininewsArchiveIndexView(GetQuerysetMixin, ArchiveIndexView):
    model = None
    date_field = 'start'
    paginate_by = 20
    # Display page even if no content; this is convenience as in practice the
    # landing page for a blog will be in the main site menu, and it's not nice
    # for that to lead to a 404.
    allow_empty = True


class MininewsYearArchiveView(GetQuerysetMixin, YearArchiveView):
    model = None
    date_field = 'start'
    paginate_by = 20
{'fraction_non_alphanumeric': 0.06998264893001735, 'fraction_numerical': 0.008097165991902834, 'mean_word_length': 3.5526315789473686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1500408', 'n_tokens_mistral': 540, 'n_tokens_neox': 507, 'n_words': 160}