Opened 19 years ago
Closed 18 years ago
#1844 closed defect (wontfix)
[patch] Subclassed model remove_fields feature is in 0.91, missing in trunk
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The Meta.remove_fields feature, shown in this example, is missing from the post-magic-removal version now on the SVN trunk. I'll attach a patch that implements it, because it's a feature I found useful.
This bug is hidden by #1790, which breaks subclassed models altogether, but has a pretty simple user-level workaround.
Attachments (1)
Change History (3)
by , 19 years ago
Attachment: | remove_fields.patch added |
---|
comment:1 by , 19 years ago
The patch looks okay, but I am not sure the feature is a good idea (even when we get model inheritance working). Normally if B is a subclass of A then "B is-a A" should be true. Removing fields breaks the "is a" relationship. In that case, put the common fields in C and have A and B both be subclasses of C.
Being able to remove fields might seem like a good idea for changing third-party models, but, again, it's not really necessary. If the third party model has a required field, you cannot remove it (it's *required* by the parent). If it's optional, you can just ignore it. However, a Meta attribute to say "these fields will be ignored" might be a good feature so that things like the Admin display and automatic form field generation for the subclassed model will not show the fields you are intentionally ignoring.
I'm not the one making the final call here. Just recording my thinking about this (since I've been looking at model inheritance a bit lately and this is something that comes up there).
comment:2 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
This feature is gone permanently; it was too much of a hack/magic.
patch to implement remove_fields