{% comment %} Reusable overview table component using django-template-partials This template can be parameterized to work with any entity type Required context variables: - entity_type: e.g., 'substance', 'polymer', 'mixture', 'isotope', 'reaction' - entity_type_plural: e.g., 'substances', 'polymers', 'mixtures', 'isotopes', 'reactions' - items_list: the queryset of items to display - page_obj: pagination object - app_color: color theme - current_sort: current sort field - current_order: 'asc' or 'desc' - filter: filter object - columns: list of column definitions with 'field', 'label', 'sortable' keys - overview_url_name: URL name for the overview view (e.g., 'lara_django_substances:polymers-overview') - create_url_name: URL name for create view - update_url_name: URL name for update view - delete_url_name: URL name for delete view - detail_url_name: URL name for detail view {% endcomment %} {% partialdef entity-filter with entity_type=entity_type entity_type_plural=entity_type_plural %} {% include "lara_django_substances/partials/entity_filter.html" with entity_type=entity_type entity_type_plural=entity_type_plural %} {% endpartialdef entity-filter %} {% partialdef entity-row with item=item %} {% include "lara_django_substances/partials/entity_row.html" with item=item %} {% endpartialdef entity-row %}
Add {{ entity_type|title }}
{% for column in columns %} {% endfor %} {% if items_list %} {% for item in items_list %} {% partial entity-row with item=item %} {% endfor %} {% if page_obj %} {% endif %} {% else %} {% endif %}
{{ column.label }} {% if column.sortable and current_sort == column.field %} {% if current_order == 'asc' %} ▲ {% else %} ▼ {% endif %} {% endif %}
Actions
{% include "lara_django_substances/partials/pagination.html" %}