Commits

H3n0xek committed 9efacf4

Bugfixes. It works now

Comments (0)

Files changed (2)

diario/views/entries.py

 from diario.settings import DIARIO_NUM_LATEST
 
 
-class EntryDetail(DetailView):    
+class EntryDetail(DateDetailView):    
     slug_field = 'slug'
     date_field = 'pub_date'
     queryset = Entry.published_on_site.all()
-    context_object_name = 'entry'
+    month_format = '%m'
+    
     
     def dispatch(self, request, *args, **kwargs):
         if request.user.has_perm('diario.change_entry'):
 class EntryArchiveYear(YearArchiveView):
     queryset = Entry.published_on_site.all()
     date_field = 'pub_date'
-    context_object_name = 'entry' # actually not needed but old urls passed this parameter in the archive_year view
+    
 
 
 class EntryArchiveMonth(MonthArchiveView):
     month_format = '%m'
     date_field = 'pub_date'
-    context_object_name = 'entry'
     queryset = Entry.published_on_site.all()
     
 
 class EntryArchiveDay(DayArchiveView):
     month_format = '%m'
     date_field = 'pub_date'
-    context_object_name = 'entry'
     queryset = Entry.published_on_site.all()
 
 
 class EntryList(ListView):
     queryset = Entry.published_on_site.all()
-    context_object_name = 'entry'
     paginate_by = DIARIO_NUM_LATEST
 

diario/views/entries_by_author.py

 from diario.models import Entry
 
 class EntryListByAuthor(ListView):
-    context_object_name = 'entry'
     paginate_by = DIARIO_NUM_LATEST
     template_name = 'diario/entry_list_by_author.html'
     
     
     def get_queryset(self):
         try:
-            self.user = User.objects.get(username=author)
+            self.user = User.objects.get(username=self.author)
         except User.DoesNotExist:
-            raise Http404(_('No User found matching "%s".') % author)
+            raise Http404(_('No User found matching "%s".') % self.author)
         return Entry.published_on_site.filter(author=self.user)
     
     def get_context_data(self, **kwargs):