Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 28 lines (18 sloc) 0.639 kb
9242ace @digi604 Initial commit
authored
1 Django Classy
2 =============
3
4
5 An approach to class based Views
6 --------------------------------
7
8 Instead of functions use classes as views.
9 This approach won't return a HttpResponse.
10 It will only return a dictionary. This allows
11 depending on who is connecting to transform the
12 dictionary into JSON, HTML, AMF, XML.
13
14 Example:
15
16 from classy.base import View
17
18 class MyView(View):
19 template = "myapp/mytemplate.html"
20
21 def get(request, id):
22 instance = get_object_or_404(MyModel, pk=id)
23 return {'object':object}
24
25 There are already base classes for form views, complete model instance edit classes and list classes.
26 More to follow.
27
Something went wrong with that request. Please try again.