document_library.views: 14 total statements, 100.0% covered

Generated: Sat 2013-02-23 20:08 SGT

Source file: /Users/martin/Repos/django-document-library/document_library/views.py

Stats: 10 executed, 0 missed, 4 excluded, 13 ignored

  1. """Views for the ``document_library`` app."""
  2. from django.views.generic import DetailView, ListView
  3. from django.utils import timezone
  4. from simple_translation.middleware import filter_queryset_language
  5. from .models import Document, DocumentCategory
  6. class DocumentListView(ListView):
  7. """A view that lists all documents for the current language."""
  8. model = Document
  9. def get_context_data(self, **kwargs):
  10. ctx = super(DocumentListView, self).get_context_data(**kwargs)
  11. ctx.update({
  12. 'categories': DocumentCategory.objects.all(),
  13. })
  14. return ctx
  15. def get_queryset(self):
  16. return Document.objects.published(self.request)
  17. class DocumentDetailView(DetailView):
  18. """A view that displays detailed information about an event."""
  19. model = Document