---
slug: "Djangoadminのフォームのテンプレートに、独自HTMLを追加する"
title: "Add Custom HTML to Django Admin Form Templates"
description: "\n\n\n1. Define change_form_template in the admin.py module\nSpecify the location of the custom template"
url: "https://www.ytyng.com/en/blog/Djangoadminのフォームのテンプレートに、独自HTMLを追加する"
publish_date: "2013-09-21T04:04:23Z"
created: "2013-09-21T04:04:23Z"
updated: "2026-02-27T10:43:11.970Z"
categories: ["Django"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/aea6af6564bb41138bddcdf12f421d59.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Add Custom HTML to Django Admin Form Templates

<div class="document">

<div class="section" id="admin-py-change-form-template">
<h3>1. Define change_form_template in the admin.py module</h3>
<p>Specify the location of the custom template</p>
<p>admin.py</p>
<pre class="literal-block">class BookmarkletAdmin(admin.ModelAdmin):
    change_form_template = 'bookmarklet/admin/change_form.html'
</pre>
</div>
<div class="section" id="id1">
<h3>2. Write the template</h3>
<p>It's easier to write by inheriting admin/change_form.html.</p>
<pre class="literal-block">{% extends 'admin/change_form.html' %}

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

Write something you like here
{% endblock %}
</pre>
</div>
</div>
