miniblog.blogs.views: 25 total statements, 93.8% covered

Generated: Thu 2012-03-01 08:22 CST

Source file: /home/alisue/Dropbox/Codes/django-permission/tests/src/miniblog/blogs/views.py

Stats: 15 executed, 1 missed, 9 excluded, 38 ignored

  1. # vim: set fileencoding=utf-8 :
  2. """
  3. Mini blog views
  4. AUTHOR:
  5. lambdalisue[Ali su ae] (lambdalisue@hashnote.net)
  6. License:
  7. The MIT License (MIT)
  8. Copyright (c) 2012 Alisue allright reserved.
  9. Permission is hereby granted, free of charge, to any person obtaining a copy
  10. of this software and associated documentation files (the "Software"), to
  11. deal in the Software without restriction, including without limitation the
  12. rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  13. sell copies of the Software, and to permit persons to whom the Software is
  14. furnished to do so, subject to the following conditions:
  15. The above copyright notice and this permission notice shall be included in
  16. all copies or substantial portions of the Software.
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  23. IN THE SOFTWARE.
  24. """
  25. from __future__ import with_statement
  26. from django.views.generic import ListView
  27. from django.views.generic import DetailView
  28. from django.views.generic import CreateView
  29. from django.views.generic import UpdateView
  30. from django.views.generic import DeleteView
  31. from django.core.urlresolvers import reverse
  32. from models import Entry
  33. from forms import EntryForm
  34. class EntryListView(ListView):
  35. model = Entry
  36. class EntryDetailView(DetailView):
  37. model = Entry
  38. slug_field = 'title'
  39. class EntryCreateView(CreateView):
  40. form_class = EntryForm
  41. model = Entry
  42. class EntryUpdateView(UpdateView):
  43. form_class = EntryForm
  44. model = Entry
  45. class EntryDeleteView(DeleteView):
  46. model = Entry
  47. def get_success_url(self):
  48. return reverse('blogs-entry-list')