﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35456	Fieldset title inside a collapsed StackedInline are `h3` but on errors are shown as `h2`	Natalia Bidart	nobody	"Given the following models:

{{{#!python
from django.db import models
from django.utils.timezone import now


class Book(models.Model):
    title = models.CharField(max_length=100)
    author = models.CharField(max_length=100)
    publisher = models.CharField(max_length=100)
    publication_date = models.DateField(default=now)

    def __str__(self):
        return self.title


class Cover(models.Model):
    book = models.ForeignKey(Book, on_delete=models.CASCADE)
    image = models.CharField(max_length=100)


class Review(models.Model):
    book = models.ForeignKey(Book, on_delete=models.CASCADE)
    reviewer = models.CharField(max_length=100)
    content = models.TextField()
    creation_date = models.DateField(default=now)

    def __str__(self):
        return f""Review of {self.book.title} by {self.reviewer_name}""
}}}

And admin models:

{{{#!python
from django.contrib import admin

from .models import Book, Cover, Review


class CoverTabularInlin(admin.TabularInline):
    model = Cover
    fieldsets = (
        (""Cover Details"", {
            ""fields"": (""image"",),
            ""classes"": (""collapse"",)
        }),
    )


class ReviewStackedInline(admin.StackedInline):
    model = Review
    fieldsets = (
        (None, {
            ""fields"": (""reviewer"",)
        }),
        (""History"", {
            ""fields"": (""content"", ""creation_date""),
            ""classes"": (""collapse"",)
        }),
    )



class BookAdmin(admin.ModelAdmin):
    list_display = (""title"", ""author"", ""publisher"",""publication_date"")
    search_fields = (""title"", ""author"")
    list_filter = (""author"", ""publication_date"")
    fieldsets = (
        (None, {
            ""fields"": (""title"", ""author"")
        }),
        (""Advanced options"", {
            ""classes"": (""collapse"",),
            ""fields"": (""publisher"", ""publication_date"",)
        }),
    )
    inlines = [
        CoverTabularInlin,
        ReviewStackedInline,
    ]


admin.site.register(Book, BookAdmin)
}}}

When visiting the admin for a `Book`, the `ReviewStackedInline` shows fieldset heading using an `h3` tag, but on errors, it uses an `h2` tag (see screenshots attached). I think the correct tag to be used both with and without errors is an `h3`."	Cleanup/optimization	closed	contrib.admin	5.0	Normal	duplicate			Unreviewed	0	0	0	0	0	1
