Opened 6 years ago
Last modified 5 years ago
#29682 closed Bug
Admin change form crashes if a view-only model's form has field not on the model — at Version 1
Reported by: | Jones | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 2.1 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Viewing an existing view-only object crashes with:
AttributeError at /admin/t29682/modela/1/change/ Unable to lookup 'form_field' on ModelA or ModelAAdmin
class ModelAForm(forms.ModelForm): class Meta: model = ModelA fields = '__all__' form_field = forms.BooleanField( label="Form Field", required=False, widget=forms.CheckboxInput() ) class ModelA(models.Model): test = models.IntegerField( null=True, blank=True ) @admin.register(ModelA) class ModelAAdmin(admin.ModelAdmin): form = ModelAForm fieldsets = ( ('Test', { 'fields': ( 'test', 'form_field' ) }), )
Change History (1)
comment:1 by , 6 years ago
Component: | Forms → contrib.admin |
---|---|
Description: | modified (diff) |
Severity: | Normal → Release blocker |
Summary: | Error in view permission with custom model form field → Admin change form crashes if a view-only model's form has field not on the model |
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.