Ticket #1844: remove_fields.patch
File remove_fields.patch, 1.7 KB (added by , 19 years ago) |
---|
-
base.py
51 51 # Add Fields inherited from parents 52 52 for parent in new_class._meta.parents: 53 53 for field in parent._meta.fields: 54 # Only add parent fields if they aren't defined for this class. 55 try: 56 new_class._meta.get_field(field.name) 57 except FieldDoesNotExist: 58 field.contribute_to_class(new_class, field.name) 54 # Only add parent fields if they aren't defined for this class, 55 # and haven't been explicitly removed in the derived class 56 if field.name not in new_class._meta.remove_fields: 57 try: 58 new_class._meta.get_field(field.name) 59 except FieldDoesNotExist: 60 field.contribute_to_class(new_class, field.name) 59 61 60 62 new_class._prepare() 61 63 -
options.py
13 13 14 14 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering', 15 15 'unique_together', 'permissions', 'get_latest_by', 16 'order_with_respect_to', 'app_label' )16 'order_with_respect_to', 'app_label', 'remove_fields') 17 17 18 18 class Options: 19 19 def __init__(self, meta): … … 27 27 self.object_name, self.app_label = None, None 28 28 self.get_latest_by = None 29 29 self.order_with_respect_to = None 30 self.remove_fields = [] 30 31 self.admin = None 31 32 self.meta = meta 32 33 self.pk = None