Add Custom HTML to Django Admin Form Templates

Django
2013-09-21 04:04 (12 years ago)
Add Custom HTML to Django Admin Form Templates

1. Define change_form_template in the admin.py module

Specify the location of the custom template

admin.py

class BookmarkletAdmin(admin.ModelAdmin):
    change_form_template = 'bookmarklet/admin/change_form.html'

2. Write the template

It's easier to write by inheriting admin/change_form.html.

{% extends 'admin/change_form.html' %}

{% block field_sets %} {% for fieldset in adminform %} {% include "admin/includes/fieldset.html" %} {% endfor %}

Write something you like here {% endblock %}

Currently unrated
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive