diff --git a/docs/dev/04_materialize_templates.rst b/docs/dev/04_materialize_templates.rst index 545d4ed8a3b6846b1d81fbdfd346424a50b90f25..cabd411377dfe2be6b3202b9275d279507356c80 100644 --- a/docs/dev/04_materialize_templates.rst +++ b/docs/dev/04_materialize_templates.rst @@ -37,10 +37,12 @@ The following snippet generates the form:: <form method="post" enctype="multipart/form-data"> {% csrf_token %} - {% form form=form %}{% endform %} + {% form form=edit_person_form %}{% endform %} {% include "core/partials/save_button.html" %} </form> +``edit_person_form`` is the variable name of the form in your ``context``. + ``{% include "core/partials/save_button.html" %}`` includes a template snippet from AlekSIS core. You can modify the buttons icon and translatable caption like this:: @@ -69,5 +71,17 @@ In your ``forms.py`` you can configure the layout of the fields like in the Edit ), ) +Tables in templates +------------------- + +To display tables generated by ``django-tables2`` in your template, you have to load the ``render_table`` template tag from ``django_tables2``:: + + {% load render_table from django_tables2 %} + +After you've loaded the template tag, you can simply generate the table like this:: + + {% render_table persons_table %} + +``persons_table`` is the variable name of the table in your ``context``. .. _MaterializeCSS: https://materializecss.com/