conjunto.components

conjunto.components.DataGrid

Bases: Component

The DataGrid class is a component that generates a data grid for displaying data in a tabular format.

It automatically determines all regular model fields and shows their translated title. It also detects properties/getters instead of fields, the component tries to find out a proper name as title here by creating a capitalized version of the property name and translating it into the locale language. However, you have to provide a proper translation string for your property name in your .po file manually.

Note To keep Django's makemessages from commenting out these "unused" translations, just add an unused _("...") string anywhere into your method. E.g. when your property is named "display_name()", just add a _("Display name") anywhere into this method block. This keeps Django from garbage collecting this translation.

Attributes:
  • object

    the Django model object to display

  • fields

    a comma separated list of field names to display

Example usage:

{% #datagrid object=request.user fields="first_name,last_name,email" %}

get_context_data(**kwargs)

renders fields of given object in a datagrid-usable form.

conjunto.components.List

Bases: Component

A flexible component to display a Tabler.io list.

Attributes:
  • items

    the list of objects to display. Should be a queryset.

  • hoverable

    whether the list items are hoverable or not.

conjunto.components.Updateable

Bases: Component

HTML element that updates itself using HTMX when a certain Javascript event is triggerd anywhere in the body.

Attributes:
  • id

    the id attribute of th div.

  • elt

    the HTML element that should be rendered. Default: div

  • trigger

    the Js event that should trigger the update

  • url

    the URL to call a get request to update the component

Example
{% updateable id="my-card" trigger="person:changed" url=request.path %}

{% url 'person:update' as person_update_url %}
{% updateable elt="ul" id="people-list" trigger="person:changed" url=person_update_url %}