| Issue 52: | mptt specific attributes not proxied | |
| 2 people starred this issue and may be notified of changes. | Back to list |
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
Sep 2, 2010
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
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 |