Skip to main content
100%

Gist 3eaebe83fc5afdf2eb57

✓ Published0🌍 Public
Aachanda101
Last edited May 18, 2014
Created on Apr 15, 2015

This example customizes Django’s admin change form template to conditionally control form submission buttons. It shows how the `submit_row` inclusion tag is suppressed for non-superusers with a `car.readonly` permission, while remaining visible for other users. The template extends `admin/base_site.html`, loads admin URL and static helpers, and uses Django’s template inheritance blocks like `field_sets` and `inline_field_sets`. It also includes JavaScript to autofocus the first form field on add pages and references admin media via `{{ media }}`. The code relies on Django’s built-in admin APIs, including `prepopulated_fields_js` and URL resolution through `{% url %}`.

AI-generated description

Similar vizzes