# Path: elephantblog/views.py
# PAGINATE_BY = getattr(settings, "BLOG_PAGINATE_BY", 10)
# class ElephantblogMixin:
# class TranslationMixin:
# class ArchiveIndexView(TranslationMixin, ElephantblogMixin, dates.ArchiveIndexView):
# class YearArchiveView(TranslationMixin, ElephantblogMixin, dates.YearArchiveView):
# class MonthArchiveView(TranslationMixin, ElephantblogMixin, dates.MonthArchiveView):
# class DayArchiveView(TranslationMixin, ElephantblogMixin, dates.DayArchiveView):
# class DateDetailView(
#     TranslationMixin, ContentObjectMixin, ElephantblogMixin, dates.DateDetailView
# ):
# class CategoryArchiveIndexView(ArchiveIndexView):
# class AuthorArchiveIndexView(ArchiveIndexView):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self):
#     def render_to_response(self, context, **response_kwargs):
#     def get_queryset(self):
#     def get_queryset(self):
#     def dispatch(self, request, *args, **kwargs):
#     def lookup_related(self):
#     def get_next_or_none(self):
#     def get_previous_or_none(self):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
# 
# Path: elephantblog/models.py
# class Entry(Base, ContentModelMixin):
#     is_active = models.BooleanField(_("is active"), default=True, db_index=True)
#     is_featured = models.BooleanField(_("is featured"), default=False, db_index=True)
# 
#     title = models.CharField(_("title"), max_length=100)
#     slug = models.SlugField(_("slug"), max_length=100, unique_for_date="published_on")
#     author = models.ForeignKey(
#         getattr(settings, "AUTH_USER_MODEL", "auth.User"),
#         on_delete=models.CASCADE,
#         related_name="blogentries",
#         limit_choices_to={"is_staff": True},
#         verbose_name=_("author"),
#     )
#     published_on = models.DateTimeField(
#         _("published on"),
#         blank=True,
#         null=True,
#         default=timezone.now,
#         db_index=True,
#         help_text=_("Will be filled in automatically when entry gets published."),
#     )
#     last_changed = models.DateTimeField(_("last change"), auto_now=True, editable=False)
# 
#     categories = models.ManyToManyField(
#         Category, verbose_name=_("categories"), related_name="blogentries", blank=True
#     )
# 
#     objects = EntryManager()
# 
#     class Meta:
#         get_latest_by = "published_on"
#         ordering = ["-published_on"]
#         verbose_name = _("entry")
#         verbose_name_plural = _("entries")
# 
#     def __str__(self):
#         return self.title
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self._old_is_active = self.is_active
# 
#     def save(self, *args, **kwargs):
#         if self.is_active and not self.published_on:
#             self.published_on = timezone.now()
# 
#         super().save(*args, **kwargs)
# 
#     save.alters_data = True
# 
#     def get_absolute_url(self):
#         # The view/template layer always works with visitors' local time.
#         # Therefore, also generate localtime URLs, otherwise visitors will
#         # hit 404s on blog entry URLs generated for them. Unfortunately, this
#         # also means that you cannot send a permalink around half the globe
#         # and expect it to work...
#         # https://code.djangoproject.com/ticket/18794
#         if settings.USE_TZ:
#             pub_date = timezone.localtime(self.published_on)
#         else:
#             pub_date = self.published_on
# 
#         return reverse(
#             "elephantblog_entry_detail",
#             kwargs={
#                 "year": pub_date.strftime("%Y"),
#                 "month": pub_date.strftime("%m"),
#                 "day": pub_date.strftime("%d"),
#                 "slug": self.slug,
#             },
#         )
# 
#     @classmethod
#     def register_extension(cls, register_fn):
#         from .modeladmins import EntryAdmin
# 
#         register_fn(cls, EntryAdmin)
# 
# Path: tests/testapp/factories.py
# class EntryFactory(DjangoModelFactory):
#     class Meta:
#         model = Entry
# 
#     is_active = True
#     is_featured = False
# 
# def create_category(title):
#     category = CategoryFactory.create()
#     CategoryTranslationFactory.create(parent=category, title=title, slug=slugify(title))
#     return category
# 
# def create_entries(factory):
#     tz = zoneinfo.ZoneInfo(settings.TIME_ZONE)
#     author = UserFactory()
#     entries = []
#     date1 = datetime.datetime(2012, 8, 12, 11, 0, 0, tzinfo=tz)
#     delta = datetime.timedelta(hours=4)
#     date2 = datetime.datetime(2012, 10, 12, 11, 1, 0, tzinfo=tz)
# 
#     entries.append(
#         factory.create(
#             pk=1,
#             author=author,
#             title="Entry 1",
#             published_on=date1,
#             last_changed=date1 + delta,
#             slug="entry-1",
#             language="en",
#         )
#     )
#     entries.append(
#         factory.create(
#             pk=2,
#             author=author,
#             title="Eintrag 1",
#             published_on=date2,
#             last_changed=date2 + delta,
#             slug="eintrag-1",
#             language="en",
#         )
#     )
#     return entries


from django.test import Client
from django.test.testcases import TestCase
from django.test.utils import override_settings
from feincms.module.medialibrary.models import MediaFile
from elephantblog import views as blogviews
from elephantblog.models import Entry
from .factories import EntryFactory, create_category, create_entries




@override_settings(SITE_ID=1)
class GenericViewsTest(TestCase):
    def setUp(self):
        create_entries(EntryFactory)

    def testURLs(self):
        c = Client()
        # Test Archive URL
        response = c.get("/blog/")
        self.assertTrue(

# Path: elephantblog/views.py
# PAGINATE_BY = getattr(settings, "BLOG_PAGINATE_BY", 10)
# class ElephantblogMixin:
# class TranslationMixin:
# class ArchiveIndexView(TranslationMixin, ElephantblogMixin, dates.ArchiveIndexView):
# class YearArchiveView(TranslationMixin, ElephantblogMixin, dates.YearArchiveView):
# class MonthArchiveView(TranslationMixin, ElephantblogMixin, dates.MonthArchiveView):
# class DayArchiveView(TranslationMixin, ElephantblogMixin, dates.DayArchiveView):
# class DateDetailView(
#     TranslationMixin, ContentObjectMixin, ElephantblogMixin, dates.DateDetailView
# ):
# class CategoryArchiveIndexView(ArchiveIndexView):
# class AuthorArchiveIndexView(ArchiveIndexView):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self):
#     def render_to_response(self, context, **response_kwargs):
#     def get_queryset(self):
#     def get_queryset(self):
#     def dispatch(self, request, *args, **kwargs):
#     def lookup_related(self):
#     def get_next_or_none(self):
#     def get_previous_or_none(self):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
# 
# Path: elephantblog/models.py
# class Entry(Base, ContentModelMixin):
#     is_active = models.BooleanField(_("is active"), default=True, db_index=True)
#     is_featured = models.BooleanField(_("is featured"), default=False, db_index=True)
# 
#     title = models.CharField(_("title"), max_length=100)
#     slug = models.SlugField(_("slug"), max_length=100, unique_for_date="published_on")
#     author = models.ForeignKey(
#         getattr(settings, "AUTH_USER_MODEL", "auth.User"),
#         on_delete=models.CASCADE,
#         related_name="blogentries",
#         limit_choices_to={"is_staff": True},
#         verbose_name=_("author"),
#     )
#     published_on = models.DateTimeField(
#         _("published on"),
#         blank=True,
#         null=True,
#         default=timezone.now,
#         db_index=True,
#         help_text=_("Will be filled in automatically when entry gets published."),
#     )
#     last_changed = models.DateTimeField(_("last change"), auto_now=True, editable=False)
# 
#     categories = models.ManyToManyField(
#         Category, verbose_name=_("categories"), related_name="blogentries", blank=True
#     )
# 
#     objects = EntryManager()
# 
#     class Meta:
#         get_latest_by = "published_on"
#         ordering = ["-published_on"]
#         verbose_name = _("entry")
#         verbose_name_plural = _("entries")
# 
#     def __str__(self):
#         return self.title
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self._old_is_active = self.is_active
# 
#     def save(self, *args, **kwargs):
#         if self.is_active and not self.published_on:
#             self.published_on = timezone.now()
# 
#         super().save(*args, **kwargs)
# 
#     save.alters_data = True
# 
#     def get_absolute_url(self):
#         # The view/template layer always works with visitors' local time.
#         # Therefore, also generate localtime URLs, otherwise visitors will
#         # hit 404s on blog entry URLs generated for them. Unfortunately, this
#         # also means that you cannot send a permalink around half the globe
#         # and expect it to work...
#         # https://code.djangoproject.com/ticket/18794
#         if settings.USE_TZ:
#             pub_date = timezone.localtime(self.published_on)
#         else:
#             pub_date = self.published_on
# 
#         return reverse(
#             "elephantblog_entry_detail",
#             kwargs={
#                 "year": pub_date.strftime("%Y"),
#                 "month": pub_date.strftime("%m"),
#                 "day": pub_date.strftime("%d"),
#                 "slug": self.slug,
#             },
#         )
# 
#     @classmethod
#     def register_extension(cls, register_fn):
#         from .modeladmins import EntryAdmin
# 
#         register_fn(cls, EntryAdmin)
# 
# Path: tests/testapp/factories.py
# class EntryFactory(DjangoModelFactory):
#     class Meta:
#         model = Entry
# 
#     is_active = True
#     is_featured = False
# 
# def create_category(title):
#     category = CategoryFactory.create()
#     CategoryTranslationFactory.create(parent=category, title=title, slug=slugify(title))
#     return category
# 
# def create_entries(factory):
#     tz = zoneinfo.ZoneInfo(settings.TIME_ZONE)
#     author = UserFactory()
#     entries = []
#     date1 = datetime.datetime(2012, 8, 12, 11, 0, 0, tzinfo=tz)
#     delta = datetime.timedelta(hours=4)
#     date2 = datetime.datetime(2012, 10, 12, 11, 1, 0, tzinfo=tz)
# 
#     entries.append(
#         factory.create(
#             pk=1,
#             author=author,
#             title="Entry 1",
#             published_on=date1,
#             last_changed=date1 + delta,
#             slug="entry-1",
#             language="en",
#         )
#     )
#     entries.append(
#         factory.create(
#             pk=2,
#             author=author,
#             title="Eintrag 1",
#             published_on=date2,
#             last_changed=date2 + delta,
#             slug="eintrag-1",
#             language="en",
#         )
#     )
#     return entries


# Path: tests/testapp/test_archive_views.py
from django.test import Client
from django.test.testcases import TestCase
from django.test.utils import override_settings
from feincms.module.medialibrary.models import MediaFile
from elephantblog import views as blogviews
from elephantblog.models import Entry
from .factories import EntryFactory, create_category, create_entries





@override_settings(SITE_ID=1)
class GenericViewsTest(TestCase):
    def setUp(self):
        create_entries(EntryFactory)

    def testURLs(self):
        c = Client()
        # Test Archive URL
        response = c.get("/blog/")
        self.assertTrue(

            isinstance(response.context["view"], blogviews.ArchiveIndexView)