---
slug: "django-5-admin-inline-hidden-dict"
title: "How to Fix Display Issues in Django Admin Inlines After Upgrading to 5.1"
description: "Hide a specific `ModelForm` field in a Django 5 Admin Inline while still passing initial values as a dict — combine `formfield_overrides` with `get_initial`."
url: "https://www.ytyng.com/en/blog/django-5-admin-inline-hidden-dict"
publish_date: "2025-03-13T09:25:40Z"
created: "2025-03-13T09:25:40Z"
updated: "2026-05-11T13:21:27.120Z"
categories: ["Django"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250503/4cac1f86c8454d71ba6e93ce6cb23bad.png.webp?width=768"
has_video: true
has_music: true
video_urls: ["https://media.ytyng.net/ytyng-blog/319/featured-video-1.mp4", "https://media.ytyng.net/ytyng-blog/319/featured-video-2.mp4", "https://media.ytyng.net/ytyng-blog/319/featured-video-3.mp4"]
music_urls: ["https://media.ytyng.net/ytyng-blog/319/featured-music-319-6.mp3", "https://media.ytyng.net/ytyng-blog/319/featured-music-319-7.mp3"]
lang: "en"
---

# How to Fix Display Issues in Django Admin Inlines After Upgrading to 5.1

This issue may occur only when using Grappelli.

From around Django 5, a key called `is_hidden` was added to the instance variable `field` of `django.contrib.admin.helpers.AdminReadonlyField`.

This key becomes `True` when the widget of an `AdminForm` is something like `HiddenInput`. (Refer to the [code](https://github.com/django/django/blob/main/django/contrib/admin/helpers.py#L220-L231))

Moreover, if `_meta.widgets['field_name']` does not exist in the `Form`, the widget becomes `HiddenInput`. (Refer to the [code](https://github.com/django/django/blob/e03440291b0599934da73b7dfbd2ccf7ec7270d8/django/forms/models.py#L1023-L1026))

Therefore, by defining `Meta` in the Admin form class and specifying something like `TextInput` in the `widgets`, you can display the widget instead of a strange `str(dict)` representation.

```python
class MyInlineAdminForm(forms.ModelForm):

    class Meta:
        # Added from Django 5. Without this, the value would be displayed as str(dict), which looks strange.
        # Specified as TextInput, but since it is ReadOnly, the ID will just be a string.
        widgets = {
            'id': forms.TextInput(),
        }

    ...
```
