Detailed 14 | descriptions, with full methods and attributes, for each of 15 | Django's class-based generic views. 16 |
17 |22 | ccbv.co.uk/ClassName/ 23 | will take you straight to the class you're looking for. 24 |
25 |41 | Django's class-based generic views provide abstract classes 42 | implementing common web development tasks. These are very powerful, 43 | and heavily-utilise Python's object orientation and multiple 44 | inheritance in order to be extensible. This means they're more than 45 | just a couple of generic shortcuts — they provide utilities 46 | which can be mixed into the much more complex views that you write 47 | yourself. 48 |
49 | 50 |
52 | All of this power comes at the expense of simplicity. For example,
53 | trying to work out exactly which method you need to customise, and
54 | what its keyword arguments are, on your UpdateView
55 | can feel a little like wading through spaghetti — it has 10
56 | separate ancestors (plus object), spread across 3
57 | different python files. This site shows you exactly what you need
58 | to know.
59 |
63 | To make things easier, we've taken all the attributes and methods 64 | that every view defines or inherits, and flattened all that 65 | information onto one comprehensive page per view. Check out 66 | UpdateView, 67 | for example. 68 |
69 |from {{ klass.import_path }} import {{ klass.name }}
45 | {{ klass.docstring }}
62 | {% endif %}
63 | {% endblock %}
64 |
65 |
66 | {% block content %}
67 | | 106 | | Defined in | 107 |
|---|---|
113 |
114 | {{ attribute.name }} = {{ attribute.value }}
115 |
116 | |
117 | 118 | {% if attribute.klass == klass %} 119 | {{ attribute.klass.name }} 120 | {% else %} 121 | {{ attribute.klass.name }} 122 | {% endif %} 123 | | 124 |
148 | def
149 | {{ method.name }}({{ method.kwargs }}):
150 |
151 | {% if namesakes|length == 1 %}
152 | {{ method.klass.name }}
153 | {% endif %}
154 | ¶
155 | {{ namesake.docstring }}{% endif %}
167 | {% pygmy namesake.code linenos='True' linenostart=namesake.line_number lexer='python' %}
168 | {{ namesake.docstring }}{% endif %}
173 | {% pygmy namesake.code linenos='True' linenostart=namesake.line_number lexer='python' %}
174 | {% endif %}
175 | {% endfor %}
176 |