Skip to content

DJ: Django Admin-Style Helpers

The gandom.dj app contains small reusable helpers for custom Django views that should look and behave like Django admin pages. Use these helpers when building template-based pages that sit alongside Django admin and should share its layout conventions.

For the broader product and UI direction behind this app, see Admin/SPA Architecture.

Forms

Rendering Form Fields

For forms rendered inside an admin-style fieldset, load the dj_forms template tags and render each bound field with dj_form_field:

{% load dj_forms %}

<fieldset class="module aligned">
  {% for field in form %}
    {% dj_form_field field %}
  {% endfor %}
</fieldset>

The tag renders markup similar to Django admin's aligned form rows.