#20565 closed New feature (fixed)
Generic view descriptions should give template examples
Reported by: | Owned by: | Baptiste Darthenay | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | bmispelon@…, Baptiste Darthenay | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
When reading the docs for generic views, I wonder what the templates should like like.
It does not seem like standard templates are provided (why not?), but as a minimum, the documentation should give an example of a template for each view class.
The template variables are idiosyncratic w.r.t. the view class, e.g., the ListView defines 'object_list' as a variable. So why not give this template example:
{% block content %} <h1>Exams</h1> <table> {% for o in object_list %} <tr><td>{{ o }}</td><td><a href="{% url 'exam_update' o.id %}">edit</a> <a href="{% url 'exam_delete' o.id %}">del</a></td></tr> {% endfor %} </table> {% endblock %}
Right now, I am looking for how to correctly implement the delete confirmation template.
Change History (6)
comment:1 by , 12 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
comment:2 by , 12 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:4 by , 12 years ago
Has patch: | set |
---|
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Seeing as we're already providing an example
views.py
andurls.py
for most views, I think it makes sense to include an example template when it makes sense.The only example template I could find was in https://docs.djangoproject.com/en/1.5/topics/class-based-views/generic-display/#generic-views-of-objects.