Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A extendable category app using django-mptt for django-shop

Project Description

A extendable category app using django-mptt for django-shop.


For the current stable version:

pip install ls-django-shop-categories

For the development version:

pip install -e git+git://

Running tests:

git clone git://
cd ls-django-shop-categories
virtualenv test_env
source ./test_env/bin/activate
pip install -r requirements.txt
python test


Add shop_categories and treeadmin to settings.INSTALLED_APPS.

Set SHOP_PRODUCT_MODEL to shop_categories.models.defaults.product.default.CategoryProduct.

In your add this before your shop patterns:

urlpatterns += patterns('',
    url(r'^catalog/', include('shop_categories.urls')),

Then run: migrate

Extending the Category model

In your own app make a models dir with and a dir, like so:


Note: Do not import the model from in, the model should NOT be in a “real” models module as this will cause the overridden Category model to be defined twice.


from django.db import models
from shop_categories.models.defaults.category.base import ProductCategoryBase

class Category(ProductCategoryBase):

    image = models.ImageField(upload_to='categoryimages/', null=True, blank=True)

    class Meta:
        abstract = False
        app_label = 'app'

Set SHOP_CATEGORIES_CATEGORY_MODEL to ('app.models.category.Category, 'app')

Register your custom category model in

from shop_categories.models import Category
from shop_categories.admin import ProductCategoryAdmin, ProductCategoryAdmin)

Then, assuming your Product model is not already synced, run: migrate

Extending the Product model

When extending Product models in your shop make sure they subclass from shop_categories.models.defaults.product.base.CategoryProductBase to add the Category Foreignkey and M2M fields.

Example implementation

An example of a django-shop with ls-django-shop-categories can be found here:


Updated dependencies


Updated default Boolean fields


Updated dependencies for ls-django-treeadmin


Forked, Renamed, Updated By Scott Sharkey Added compatibility with Django 1.7+, and eventually Python 3


Last release by original author

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(7.8 kB) Copy SHA256 Hash SHA256
Source None Jan 4, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate