Opened 18 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: Chris Chamberlin <dja @…> 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)

remove_fields.patch (1.7 KB ) - added by anonymousChris Chamberlin <dja @…> 18 years ago.
patch to implement remove_fields

Download all attachments as: .zip

Change History (3)

by anonymousChris Chamberlin <dja @…>, 18 years ago

Attachment: remove_fields.patch added

patch to implement remove_fields

comment:1 by Malcolm Tredinnick <malcolm@…>, 18 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 Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: newclosed

This feature is gone permanently; it was too much of a hack/magic.

Note: See TracTickets for help on using tickets.
Back to Top