Code

Opened 8 years ago

Closed 8 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
Component: Core (Other) Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 @…> 8 years ago.
patch to implement remove_fields

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by anonymousChris Chamberlin <dja @…>

patch to implement remove_fields

comment:1 Changed 8 years ago by Malcolm Tredinnick <malcolm@…>

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 Changed 8 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.