Re: db.models.options help with a piece of code analysis.

2016-01-18 Thread Elton Pereira de Lima
Really, it's true! Thanks for help! -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googleg

Re: db.models.options help with a piece of code analysis.

2016-01-18 Thread charettes
FWIW, as Marteen pointed out, the `Meta` attribute is only available on abstract classes because of these lines . Simon Le lundi 18 janvier 2016 13:09:16 UTC-5, charettes a écrit :

Re: db.models.options help with a piece of code analysis.

2016-01-18 Thread charettes
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 Le lundi 18 janvier 2016 12:34:29 UTC-5, Elton Pereira

Re: db.models.options help with a piece of code analysis.

2016-01-18 Thread Marten Kenbeek
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: class Foo(models.Model

Re: db.models.options help with a piece of code analysis.

2016-01-18 Thread Elton Pereira de Lima
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

Re: db.models.options help with a piece of code analysis.

2016-01-18 Thread Elton Pereira de Lima
Thanks for help! -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post t

Re: db.models.options help with a piece of code analysis.

2016-01-15 Thread charettes
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 B

db.models.options help with a piece of code analysis.

2016-01-15 Thread Elton Pereira de Lima
What's up guys! I am studying the core of django and I came across a piece of code that confused me. https://github.com/django/django/blob/master/django/db/models/options.py#L192-L194 If meta_attr is a copy of self.meta .__ dict__, then when will the marked section will run? Thanks! -- You