Subclassing Satchmo's Category model, but then getting the error "'Manager' object has no attribute 'root_categories'"
- by hellsgate
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?