Permalink
Browse files

Documentation in progress

  • Loading branch information...
1 parent fdaa984 commit cbbbee3edcf2cf2f9d76e4c8c0294f132c538a7f @davidbgk davidbgk committed with David Larlet Sep 30, 2010
Showing with 65 additions and 5 deletions.
  1. +58 −1 README.md
  2. +2 −2 class_based_views/detail.py
  3. +5 −2 class_based_views/edit.py
View
@@ -1,9 +1,66 @@
django-class-based-views
-====================
+========================
Work on [ticket #6735](http://code.djangoproject.com/ticket/6735).
Installation
------------
$ python setup.py install
+
+
+Usage
+-----
+
+Inherit your own class-based views from existing ones listed below.
+
+Note: you must declare an **instance** of the class in your URLs, not the
+ class in order to avoid shared attributes across requests.
+
+Views
+-----
+
+CRUD views
+~~~~~~~~~~
+
+* ListView: Render some list of objects, set by `self.queryset`.
+ This can be any iterable of items, not just a queryset.
+
+* DetailView: Render a "detail" view of an object. By default this is a
+ model instance looked up from `self.queryset`, but the view will support
+ display of *any* object by overriding `self.get_object()`.
+
+* CreateView: View for creating an object.
+
+* UpdateView: View for updating an object.
+
+* DeleteView: View for deleting an object retrieved with `self.get_object()`.
+
+
+Extra views
+~~~~~~~~~~~
+
+* PaginatedListView
+* ProcessFormView
+* ProcessModelFormView
+* DisplayFormView
+* DisplayModelFormView
+
+
+Date-based views
+~~~~~~~~~~~~~~~~
+
+* ArchiveView
+* YearView
+* MonthView
+* WeekView
+* DayView
+* TodayView
+* DateDetailView
+
+
+
+API
+---
+
+TODO
@@ -69,8 +69,8 @@ class DetailView(SingleObjectMixin, TemplateView):
"""
Render a "detail" view of an object.
- By default this is a model instance lookedup from `self.queryset`, but the
- view will support display of *any* object by overriding `get_object()`.
+ By default this is a model instance looked up from `self.queryset`, but the
+ view will support display of *any* object by overriding `self.get_object()`.
"""
template_object_name = 'object'
template_name_field = None
@@ -120,17 +120,20 @@ def form_invalid(self, form):
class CreateView(ModelFormMixin, DisplayFormView, ProcessFormView):
"""
- View for creating objects.
+ View for creating an object.
"""
class UpdateView(ModelFormMixin, DisplayModelFormView, ProcessModelFormView):
"""
- View for updating objects.
+ View for updating an object.
"""
class DeleteView(DetailView):
+ """
+ View for deleting an object retrieved with `self.get_object()`.
+ """
def POST(self, request, *args, **kwargs):
obj = self.get_object(*args, **kwargs)
obj.delete()

0 comments on commit cbbbee3

Please sign in to comment.