Django

Code

Ticket #5817: model_meta_w_inheritance.diff

File model_meta_w_inheritance.diff, 0.9 kB (added by miracle2k, 9 months ago)
  • options.py

    old new  
    4747 
    4848        # Next, apply any overridden values from 'class Meta'. 
    4949        if self.meta: 
    50             meta_attrs = self.meta.__dict__ 
    51             del meta_attrs['__module__'] 
    52             del meta_attrs['__doc__'] 
     50            # Build list of attributes - don't use __dict__, as we want to include 
     51            # super class attributes as well. 
     52            meta_attrs = dict([ 
     53                (name, getattr(self.meta, name))  
     54                for name in dir(self.meta)  
     55                # exclude python built-in attributes 
     56                if not name.startswith('__')]) 
    5357            for attr_name in DEFAULT_NAMES: 
    5458                setattr(self, attr_name, meta_attrs.pop(attr_name, getattr(self, attr_name))) 
    5559            # verbose_name_plural is a special case because it uses a 's'