django-grappelli icon indicating copy to clipboard operation
django-grappelli copied to clipboard

Readonly field displayed incorrectly

Open lthamm opened this issue 3 years ago • 1 comments

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>

lthamm avatar Feb 23 '22 16:02 lthamm

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 avatar Apr 15 '22 10:04 sehmaschine

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

sehmaschine avatar Sep 14 '22 09:09 sehmaschine

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

maldn avatar Oct 04 '22 09:10 maldn

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.

sehmaschine avatar Oct 05 '22 10:10 sehmaschine