Skip to content
Snippets Groups Projects
Commit 2c8a53bb authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add documentation about tables in templates

parent 9f13bdd2
No related branches found
No related tags found
1 merge request!333Documentation for beta release (Documentation for first release part 1)
......@@ -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/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment