Skip to content

Some nested views incompatible with Django 4.0 admin changes #211

Open
@gaige

Description

@gaige

We've been planning a move to Django 4.0 and haven't run into any showstoppers yet, however, on our admin pages, we've seen some unnecessary text showing up since the update. (Thanks for updating the build, etc. for 4.0!)

In my nested forms (which have a single FK and a single PK, which is a string that is useful to show to the admin user), I'm seeing the tabular.html producing a dictionary output on top of the printed string. For example:

{'name': 'code', 'label': 'code', 'help_text': '', 'field': 'code', 'is_hidden': True} appearing in the HTML after the text of the same field in <p>...</p> and the hidden <input> comprising the original field. The result is that the aforementioned text (a dictionary coming from the AdminReadonlyField's field member, build in the constructor. It appears there were some notable changes affecting how this is handled in this commit made in September of this year to align the stacked and inline views. However, this makes the current template in django-nested-admin place unnecessary text in the output.

The proximate cause appears to be that hidden is now being set to something other than False, which was it's previous value for anything that came from readonly.

I'd submit a PR, but I'm looking for guidance on:

  1. Appropriate way to adjust the behavior depending upon 4.0 vs pre-4.0 (maybe a separate template? not clear, but that's an architectural decision)
  2. Thoughts on ramifications of aligning the 4.0+ version of the html to the tabular view

Thanks,
-Gaige

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions