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):
    class Meta:
        app_label = 'app'
        abstract = True

class Bar(models.Model):
    class Meta(Foo.Meta):
        pass

assert 'app_label' not in Bar.Meta.__dict__
assert Bar.Meta.app_label == 'app'


On Monday, January 18, 2016 at 6:34:29 PM UTC+1, Elton Pereira de Lima 
wrote:
>
> 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 
> <https://github.com/django/django/blob/master/django/db/models/base.py#L108> 
> is executed, the Meta class ceases to exist because of this line 
> <https://github.com/django/django/blob/master/django/db/models/options.py#L212>
> .
>

-- 
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 to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/411c9ca0-f718-4ae5-835c-fcaa6edd4cf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to