#14496: Conflict between ModelForm.Meta.exclude and ModelAdmin.readonly attributes -------------------------------------+------------------------------------- Reporter: | Owner: nobody msgre_valise | Status: new Type: Bug | Component: contrib.admin Milestone: | Severity: Normal Version: 1.2 | Keywords: ModelForm Resolution: | ModelAdmin readonly_fields exclude Triage Stage: Accepted | conflict Needs documentation: 0 | Has patch: 1 Patch needs improvement: 0 | Needs tests: 0 | Easy pickings: 0 -------------------------------------+-------------------------------------
Comment (by julien): I've had second thoughts about this and posted an alternative patch. I still think this ticket is a valid bug. The confusion mostly comes from the fact that defining `readonly_fields` makes the `ModelAdmin` ignore the `ModelForm`'s `Meta.exclude` option even if the `ModelAdmin` doesn't define its own `exclude`. Both patches fix that bug. However, while the first patch systematically considers the `ModelForm.Meta.exclude` option, the new patch only considers it if `ModelAdmin` doesn't define its own `exclude`. If `ModelAdmin` does define `exclude`, then it takes precedence. This is a way of transferring control from `ModelForm` to `ModelAdmin`, which seems like a more explicit way of handling things. -- Ticket URL: <http://code.djangoproject.com/ticket/14496#comment:5> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.