Subclassing Satchmo's Category model, but then getting the error "'Manager' object has no attribute 'root_categories'"
Posted
by
hellsgate
on Stack Overflow
See other posts from Stack Overflow
or by hellsgate
Published on 2011-01-11T14:49:13Z
Indexed on
2011/01/11
14:53 UTC
Read the original article
Hit count: 371
I'm using Satchmo as part of a website I'm currently building. At the moment I'm trying add more functions to the Satchmo Category class, but obviously I'm not going to make any changes to the Satchmo files. So, I thought that subclassing the Category class would give me a new class which contains all the Satchmo Category properties and methods while allowing me to add my own. However, either Python subclassing doesn't work like that, or I am doing it wrong. Here is the code I'm using to subclass Category:
from product.models import Category
class MyCategory(Category):
""" additional functions to pull data from the Satchmo store app """
One of the methods I can normally use from the Category class is:
Category.objects.root_categories()
however, when I try to access
MyCategory.objects.root_categories()
I get the following error:
AttributeError: 'Manager' object has no attribute 'root_categories'
Can anyone point me in the right direction for solving this?
© Stack Overflow or respective owner