sehmaschine / django-grappelli

A jazzy skin for the Django Admin-Interface (official repository).
http://www.grappelliproject.com
Other
3.77k stars 657 forks source link

Readonly field displayed incorrectly #990

Closed lthamm closed 1 year ago

lthamm commented 2 years ago

Django version: 4.0 Grappelli 3.0.3

Problem: An admin.TabularInline has a readonly_field ("id"). This is rendered incorrectly. It works without grappelli and it used to work prior to Django 4.0.

Output:

<div class="form-row grp-module grp-tbody has_original grp-dynamic-form" id="{ID}">
    <h3 style="display: none;">{MODEL_STR}</h3>
    {'name': 'id', 'label': 'id', 'help_text': '', 'field': 'id', 'is_hidden': True} 
  <div class="grp-tr">
        ....
  </div>
</div>
sehmaschine commented 2 years ago

interesting – this works with my setup (I have 2 hidden input fields at the end of div).

what exactly is that dict after h3?

sehmaschine commented 2 years ago

closing this since no further details have been given. please reopen with additional information if you think this is a bug which still exists.

maldn commented 2 years ago

I stumbled over this one as well. If you include "id" in the readonly_fields of the inline, or if you have has_change_permission() return False, the dict gets shown. For me the solution is to just omit the "id" field

sehmaschine commented 2 years ago

The "ID" field is always hidden, right? So this issue has nothing to do with readonly ... or do I miss something?

I am able to reproduce seeing the dict with adding an "ID" field to my inlines. I'm just trying to understand what exactly we're talking about.