Documentation - include {{ block.super }} example in modelAdmin

pull/5679/head
Dan Swain 2019-11-11 17:52:09 -05:00 zatwierdzone przez LB
rodzic 5a8c4edba5
commit 749d0172e5
3 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -15,6 +15,8 @@ Changelog
* Added `ancestors` field to pages endpoint in admin API (Karl Hobley)
* Removed Django admin management of `Page` & `Site` models (Andreas Bernacca)
* Cleaned up Django docs URLs in documentation (Pete Andrew)
* Add StreamFieldPanel to available panel types in documentation (Dan Swain)
* Add {{ block.super }} example to ModelAdmin customisation in documentation (Dan Swain)
* Fix: Rename documents listing column 'uploaded' to 'created' (LB (Ben Johnston))
* Fix: Submenu items longer then the page height are no longer broken by the submenu footer (Igor van Spengen)
* Fix: Unbundle the l18n library as it was bundled to avoid installation errors which have been resolved (Matt Westcott)

Wyświetl plik

@ -162,7 +162,21 @@ each view:
- ``'delete.html'`` for ``DeleteView``
- ``'choose_parent.html'`` for ``ChooseParentView``
If for any reason you'd rather bypass this behaviour and explicitly specify a
To add extra information to a block within one of the above Wagtail templates, use Django's ``{{ block.super }}`` within the ``{% block ... %}`` that you wish to extend. For example, if you wish to display an image in an edit form below the fields of the model that is being edited, you could do the following:
.. code-block:: html+django
{% extends "modeladmin/edit.html" %}
{% load static %}
{% block content %}
{{ block.super }}
<div class="object">
<img src="{% get_media_prefix %}{{ instance.image }}"/>
</div>
{% endblock %}
If for any reason you'd rather bypass the above behaviour and explicitly specify a
template for a specific view, you can set either of the following attributes
on your ``ModelAdmin`` class:

Wyświetl plik

@ -24,6 +24,8 @@ Other features
* Added ``ancestors`` field to pages endpoint in admin API (Karl Hobley)
* Removed Django admin management of ``Page`` & ``Site`` models (Andreas Bernacca)
* Cleaned up Django docs URLs in documentation (Pete Andrew)
* Add StreamFieldPanel to available panel types in documentation (Dan Swain)
* Add {{ block.super }} example to ModelAdmin customisation in documentation (Dan Swain)
Bug fixes