diff --git a/django_tables2/templates/django_tables2/bootstrap5-responsive.html b/django_tables2/templates/django_tables2/bootstrap5-responsive.html new file mode 100644 index 00000000..d5580b6e --- /dev/null +++ b/django_tables2/templates/django_tables2/bootstrap5-responsive.html @@ -0,0 +1,13 @@ +{% extends 'django_tables2/bootstrap4.html' %} + +{% block table-wrapper %} +
+ {% block table %} + {{ block.super }} + {% endblock table %} + + {% block pagination %} + {{ block.super }} + {% endblock pagination %} +
+{% endblock table-wrapper %} diff --git a/docs/pages/custom-rendering.rst b/docs/pages/custom-rendering.rst index e061e488..d0921e68 100644 --- a/docs/pages/custom-rendering.rst +++ b/docs/pages/custom-rendering.rst @@ -68,23 +68,26 @@ Available templates We ship a couple of different templates: -======================================== ====================================================== -Template name Description -======================================== ====================================================== -django_tables2/table.html Basic table template (default). -django_tables2/bootstrap.html Template using bootstrap 3 structure/classes -django_tables2/bootstrap4.html Template using bootstrap 4 structure/classes -django_tables2/bootstrap-responsive.html Same as bootstrap, but wrapped in ``.table-responsive`` -django_tables2/semantic.html Template using semantic UI -======================================== ====================================================== +======================================== ====================================================== +Template name Description +======================================== ====================================================== +django_tables2/table.html Basic table template (default). +django_tables2/bootstrap.html Template using bootstrap 3 structure/classes +django_tables2/bootstrap-responsive.html Same as bootstrap, but wrapped in ``.table-responsive`` +django_tables2/bootstrap4.html Template using bootstrap 4 structure/classes +django_tables2/bootstrap4-responsive.html Same as bootstrap4, but wrapped in ``.table-responsive`` +django_tables2/bootstrap5.html Template using bootstrap 5 structure/classes +django_tables2/bootstrap5-responsive.html Same as bootstrap5, but wrapped in ``.table-responsive`` +django_tables2/semantic.html Template using semantic UI +======================================== ====================================================== By default, django-tables2 looks for the ``DJANGO_TABLES2_TEMPLATE`` setting which is ``django_tables2/table.html`` by default. -If you use bootstrap 3 for your site, it makes sense to set the default to -the bootstrap 3 template:: +If you use bootstrap 5 for your site, it makes sense to set the default to +the bootstrap 5 template:: - DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap.html" + DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap5.html" If you want to specify a custom template for selected tables in your project, you can set a ``template_name`` attribute to your custom ``Table.Meta`` class::