Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readonly field displayed incorrectly #990

Closed
lthamm opened this issue Feb 23, 2022 · 4 comments
Closed

Readonly field displayed incorrectly #990

lthamm opened this issue Feb 23, 2022 · 4 comments

Comments

@lthamm
Copy link

lthamm commented Feb 23, 2022

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Contributor

maldn commented Oct 4, 2022

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 sehmaschine reopened this Oct 4, 2022
@sehmaschine
Copy link
Owner

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 added a commit that referenced this issue Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants