# How to have a non-updating field on form

**URL:** <https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679>\
**Category:** Using Django\
**Created:** [December 13, 2020, 8:24pm UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679 "2020-12-13T20:24:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![typonaut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/typonaut/32/2316_2.png) [@typonaut](https://forum.djangoproject.com/u/typonaut)\
**Post date:** [December 13, 2020, 8:24pm UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679/1 "2020-12-13T20:24:41Z")

</div>

Is it possible to have a field on a Django form that does not either exist in the database, and/or update when the form is updated?

I tried something like this, examples of which were online, but those examples didn’t have `Meta` in the class:

```auto
class ItemFormBarcode(forms.ModelForm):
    category = forms.ChoiceField(choices=Item.category_displaychoices, widget=forms.RadioSelect)
    extra_field = forms.IntegerField()

    class Meta:
        model = Item
        fields = (
            'extra_field',
            'barcode',
            'category',
            'group',
            'title',
            'description',
            'price',
            'imgurl',
        )

```

If I put `extra_field` in the `fields` list I get the error:

`django.core.exceptions.FieldError: Unknown field(s) (extra_field) specified for Item`

If it is not in the `fields` list is obviously does not show.

My alternative at the moment is to fire a process after the save to remove the data in the field.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 13, 2020, 8:53pm UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679/2 "2020-12-13T20:53:32Z")

</div>

> [@typonaut](#):
>
> If it is not in the `fields` list is obviously does not show.

What makes you think this is true?

A ModelForm is an extension to a standard Form. The fields setting in Meta identifies which fields _of a model_ are to be in included in the form. Other fields defined are part of the form, just like any other form.

---

<div class="post-metadata">

**Author:** ![typonaut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/typonaut/32/2316_2.png) [@typonaut](https://forum.djangoproject.com/u/typonaut)\
**Post date:** [December 14, 2020, 2:31am UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679/3 "2020-12-14T02:31:49Z")

</div>

Aye, ye be right. Thought I’m pretty sure I did it earlier and it wasn’t there…

---

<div class="post-metadata">

**Author:** ![Spidiffpaffpuff](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/spidiffpaffpuff/32/1557_2.png) [@Spidiffpaffpuff](https://forum.djangoproject.com/u/Spidiffpaffpuff)\
**Post date:** [December 14, 2020, 1:17pm UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679/4 "2020-12-14T13:17:46Z")

</div>

Where you trying to display a form in the admin?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 14, 2020, 2:26pm UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679/5 "2020-12-14T14:26:46Z")

</div>

If you assign your form to the ModelAdmin class, it’ll show up there, too.

---

<div class="post-metadata">

**Author:** ![typonaut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/typonaut/32/2316_2.png) [@typonaut](https://forum.djangoproject.com/u/typonaut)\
**Post date:** [December 14, 2020, 3:40pm UTC](https://forum.djangoproject.com/t/how-to-have-a-non-updating-field-on-form/5679/6 "2020-12-14T15:40:37Z")

</div>

Not in admin, just in normal logged-in user view. Probably just a browser issue, or runserver did not restart, or `luser` error. 🙂
