#35872 closed New feature (wontfix)
Add error message when invalid ModelForm Meta attributes are set
Reported by: | jernwerber | Owned by: | jernwerber |
---|---|---|---|
Component: | Forms | Version: | 5.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Invalid (e.g., non-existent, misspelled) attributes that are added to a ModelForm
's inner Meta
class are silently ignored, but they should instead raise an error since they would signal either a mistake or misunderstanding/misapplication of the Meta class (as is the case elsewhere, e.g., if an invalid attribute is included in a Model
's inner Meta
class, a TypeError is raised).
Change History (4)
follow-up: 4 comment:1 by , 7 weeks ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
follow-up: 3 comment:2 by , 7 weeks ago
Worth noting that #5793 is a long-standing ticket to allow custom Model Meta attributes… — it’s not monotonic here.
comment:3 by , 7 weeks ago
Replying to Carlton Gibson:
Worth noting that #5793 is a long-standing ticket to allow custom Model Meta attributes… — it’s not monotonic here.
Oh wow, long-standing indeed (opened 17 years ago)! And it even references ModelForm's Meta
class, somewhat more recently at 8 years ago. My (admittedly limited) understanding of Django's architecture was consistent with the first comment on that ticket, namely that these Meta
classes are go-betweens for private parts of the API since the Meta
class itself is essentially ignored once the corresponding attributes have been set on the ModelForm. The discussion on Model's Meta
attributes still seems to support validation of the attributes, so even if custom attributes were to be allowed, I think one would still expect an error of some sort to be raised should an invalid attribute (however that's determined) be set.
comment:4 by , 7 weeks ago
Replying to Sarah Boyce:
Thank you for the ticket
I think I agree with this in principle. However, as this sounds backwards incompatible, can you first raise this on the Django forum and see what other folks think?
If we have community agreement that we should do this, you can link the discussion and reopen the ticket
OK, I'll head over there and bring it up!
Thank you for the ticket
I think I agree with this in principle. However, as this sounds backwards incompatible, can you first raise this on the Django forum and see what other folks think?
If we have community agreement that we should do this, you can link the discussion and reopen the ticket