Improve styling of EmbeddedModelField/EmbeddedModelArrayField in the Django admin

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: django
    • None
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Following INTPYTHON-643, a number of layout and styling issues with EmbeddedModelField/EmbeddedModelArrayField in the Django admin remain. This description isn't meant to be exhaustive. The solution must be checked with various combinations of EmbeddedModelField/EmbeddedModelArrayField to ensure reasonable layouts. 

      1. Here's a screenshot for a Book model with name & author fields. Author is an embedded model with address and name fields. Its name field awkwardly floats off to the right. Address is an embedded model with street and tags field, where tag is an EmbeddedModelArrayField. Errors on subfields of Tag float to the right.

      2. For the example queryable encryption models (Billing, an embedded model in PatientRecord, an embedded model in Patient), an error in the Billing model does not highlight the field (red outline) as expected and the error message floats to the right.

      To register admin widgets for these fields, patch django.contrib.admin.options.FORMFIELD_FOR_DBFIELD_DEFAULTS. (Admin-only widgets should be used since the admin styling won't match user applications.)

        1. Screenshot from 2026-06-22 17-43-46.png
          43 kB
          Tim Graham
        2. Screenshot from 2026-06-22 17-44-33.png
          31 kB
          Tim Graham

            Assignee:
            Unassigned
            Reporter:
            Tim Graham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: