Issue 52: mptt specific attributes not proxied
Status:  Duplicate
Merged:  issue 34
Owner: ----
Closed:  Sep 2010
Reported by dotsph...@gmail.com, Jul 2, 2009
Consider a heterogenous tree of groups and products modelled using one
model "ProductNode". ProductNode is registered with mptt
("mptt.register(ProductNode)").

Now, in order to provide separate admin interfaces for products and groups,
I make use of Django proxy objects, as follows:

class Product(ProductNode):
    objects = ProductManager()
    class Meta:
        proxy = True

class ProductGroup(ProductNode):
    objects = ProductGroupManager()
    class Meta:
        proxy = True

This enables me to leave out certain Product-specific fields from
ProductNode out of the ProductGroup admin interface, which works really well.

However, when attempting to modify any of the proxy objects, the following
exception is thrown:

AttributeError: 'ProductGroup' object has no attribute 'lft'

I would expect that the mptt specific attributes were proxied
automatically, without having to register Product and ProductGroup to mptt.

Jul 22, 2009
#1 pcicman@gmail.com
This problem comes from _meta. Field names are assigned to _meta on registered model. It will require to have 
those assigned to Meta (class) also, but actually there isn't any way how to assign something to Meta - because 
of the Options checker - this should be changed in django itself. There should be support for user defined meta 
attributes.

When the proxy gets created, it mixes up _meta for it based on origin Meta, so specific fields are not in proxy 
anymore. The same problem happens with model inheritance.  
Sep 2, 2010
Project Member #2 craig.ds@gmail.com
Fixing this would require some level of deep magic. As pcicman points out, merely adding the fields to the model is the easy part. We need to add things to the _meta as well.

One option is to add a metaclass to the model which automatically registers model subclasses. Enough magic to make me uncomfortable, but maybe someone can improve on that.

Status: Chatting
Sep 20, 2010
Project Member #3 craig.ds@gmail.com
This can be considered fixed in the abstract-model-refactor branch, since that uses abstract models, and fields inherit nicely.

Closing, any further discussion should go to  Issue 34 
Status: Duplicate
Mergedinto: 34