diff options
| author | Joe Simpson <kennydude@users.noreply.github.com> | 2015-02-11 10:22:13 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-13 10:34:17 -0500 |
| commit | 648e516b8d5694c01a225fe27429f0bf7776fb43 (patch) | |
| tree | 3fed7fb9d275f6d63ac17b5a1149b834b3296c10 /docs/ref/contrib/admin | |
| parent | 002425fe39f62faafaa32e400f7531809181a1a0 (diff) | |
Added each_context() and a template tip to custom admin view docs.
Diffstat (limited to 'docs/ref/contrib/admin')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index ae61c01869..35364b07cf 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1406,8 +1406,23 @@ templates used by the :class:`ModelAdmin` views: return my_urls + urls def my_view(self, request): - # custom view which should return an HttpResponse - pass + # ... + context = dict( + # Include common variables for rendering the admin template. + self.each_context(), + # Anything else you want in the context... + key=value, + ) + return TemplateResponse(request, "sometemplate.html", context) + + If you want to use the admin layout, extend from ``admin/base_site.html``: + + .. code-block:: html+django + + {% extends "admin/base_site.html" %} + {% block content %} + ... + {% endblock %} .. note:: |
