If meta_attr is a copy of self.meta .__ dict__, then when will the marked section will run?
Thanks!
charettes
unread,
Jan 15, 2016, 12:13:50 PM1/15/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Hi Elton,
From a quick look this branch seems to handle attributes inherited from possible `Meta` bases.
e.g.
class Foo(models.Model): class Meta: app_label = 'app'
class Bar(models.Model): class Meta(Foo.Meta): pass
assert 'app_label' not in Bar.Meta.__dict__ assert Bar.Meta.app_label == 'app'
Cheers, Simon
Elton Pereira de Lima
unread,
Jan 18, 2016, 7:35:30 AM1/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Thanks for help!
Elton Pereira de Lima
unread,
Jan 18, 2016, 12:34:29 PM1/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Hello charettes!
Analyzing the code further, I saw that it was impossible for the Bar Meta class inherits from Foo.Meta because when this code is executed, the Meta class ceases to exist because of this line.
Marten Kenbeek
unread,
Jan 18, 2016, 12:47:22 PM1/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Hi Elton,
Django makes the Meta class of abstract models available as Foo.Meta. This allows you to define common Meta options on the abstract base class, and inherit the base Meta in your concrete child models. So the above example won't work as you noted, but this will:
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
Hi Elton,
From what I understand the line you pointed at doesn't delete the model `Meta` attribute but the `_meta.meta` attribute which makes it possible for `Bar.Meta` to subclass `Foo.Meta` even if `Foo.Meta.abstract is not True`.
Simon
charettes
unread,
Jan 18, 2016, 1:14:06 PM1/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)
FWIW, as Marteen pointed out, the `Meta` attribute is only available on abstract classes because of these lines.
Simon
Elton Pereira de Lima
unread,
Jan 18, 2016, 1:23:44 PM1/18/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django developers (Contributions to Django itself)