Commits

Guilherme Gondim committed 8226057

rename views and remove diario.settings module

Comments (0)

Files changed (3)

diario/settings.py

-# -*- coding: utf-8 -*-
-#
-#  Copyright (c) 2007-2012 Guilherme Gondim and contributors
-#
-#  This file is part of Django Diário.
-#
-#  Django Diário is free software under terms of the GNU Lesser
-#  General Public License version 3 (LGPLv3) as published by the Free
-#  Software Foundation. See the file README for copying conditions.
-#
-
-"""
-Default Diário application settings.
-
-If you do not configure the settings below in your own project settings.py,
-they will assume default values::
-
-    DIARIO_PAGINATE_BY
-        Number of entries to paginate. Default: 10.
-
-"""
-
-from django.conf import settings
-
-
-PAGINATE_BY = getattr(settings, 'DIARIO_PAGINATE_BY', 10)

diario/views/entries.py

 from django.views.generic import dates
 from django.views.generic.list import ListView
 
-from diario.settings import PAGINATE_BY
 from diario.views.mixins.base import BasicEntryMixin
 
 
-class EntryDetailView(BasicEntryMixin, dates.DateDetailView):
+class BaseEntryDetailView(BasicEntryMixin, dates.DateDetailView):
     date_field = 'pub_date'
     month_format = '%m'
     slug_field = 'slug'
             self.queryset = self.model.objects.all()
         else:
             self.allow_future = False
-        return super(EntryDetailView, self).dispatch(request, *args, **kwargs)
+        return super(BaseEntryDetailView, self).dispatch(request, *args, **kwargs)
 
 
-class EntryArchiveYearView(BasicEntryMixin, dates.YearArchiveView):
+class BaseEntryArchiveYearView(BasicEntryMixin, dates.YearArchiveView):
     date_field = 'pub_date'
 
 
-class EntryArchiveMonthView(BasicEntryMixin, dates.MonthArchiveView):
+class BaseEntryArchiveMonthView(BasicEntryMixin, dates.MonthArchiveView):
     date_field = 'pub_date'
     month_format = '%m'
 
 
-class EntryArchiveDayView(BasicEntryMixin, dates.DayArchiveView):
+class BaseEntryArchiveDayView(BasicEntryMixin, dates.DayArchiveView):
     date_field = 'pub_date'
     month_format = '%m'
 
 
-class EntryListView(BasicEntryMixin, ListView):
-    paginate_by = PAGINATE_BY
+class BaseEntryListView(BasicEntryMixin, ListView):
+    pass

diario/views/entries_by_author.py

 from django.shortcuts import get_object_or_404
 from django.views.generic.list import ListView
 
-from diario.settings import PAGINATE_BY
 from diario.views.mixins import BasicEntryMixin
 
 
-class EntryListByAuthorView(BasicEntryMixin, ListView):
-    paginate_by = PAGINATE_BY
+class BaseEntryListByAuthorView(BasicEntryMixin, ListView):
+    paginate_by = 10
     template_name = 'diario/entry_list_by_author.html'
     
     def get_queryset(self):
-        queryset = super(EntryListByAuthorView, self).get_queryset()
+        queryset = super(BaseEntryListByAuthorView, self).get_queryset()
         queryset = queryset.filter(visible=True, pub_date__lte=datetime.now)
         username = self.kwargs.get('username')
         return queryset.by_author(username)
 
     def get_context_data(self, **kwargs):
-        context = super(EntryListByAuthorView, self).get_context_data(**kwargs)
+        context = super(BaseEntryListByAuthorView, self).get_context_data(**kwargs)
         username = self.kwargs.get('author')
         context['author'] = get_object_or_404(User, username=username)
         return context