[Fixed]-How do you add a non-editable field to a custom admin form in Django


You need to remove the non-editable field from your class form list of fields :

class HelpDeskModelForm(forms.ModelForm):

    class Meta:
      model = HelpDesk
      fields = [

And keep the read-only fields in the ModelAdmin like you did :

class HelpDeskModelAdmin(admin.ModelAdmin):
    form = HelpDeskModelForm

Leave a comment