django-shop-categories
A extendable category app using django-mptt for django-shop.
Installation
For the current stable version:
pip install django-shop-categories
For the development version:
pip install -e git+git://github.com/fivethreeo/django-shop-categories.git#egg=django-shop-categories
Running tests:
git clone git://github.com/fivethreeo/django-shop-categories.git cd django-shop-categories virtualenv test_env source ./test_env/bin/activate pip install -r requirements.txt python runtests.py
Configuration
Add shop_categories to settings.INSTALLED_APPS.
Set SHOP_PRODUCT_MODEL to shop_categories.models.defaults.product.default.CategoryProduct.
In your urls.py add this before your shop patterns:
urlpatterns += patterns('',
url(r'^catalog/', include('shop_categories.urls')),
)
Then run:
manage.py syncdb
Extending the Category model
In your own app make a models dir with __init__.py and a category.py dir, like so:
app/models/__init__.py app/models/category.py
Note: Do not import the model from category.py in __init__.py, the model should NOT be in a “real” models module as this will cause the overridden Category model to be defined twice.
In category.py:
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
Register your custom category model in admin.py:
from shop_categories.models import Category from shop_categories.admin import ProductCategoryAdmin admin.site.register(Category, ProductCategoryAdmin)
Then, assuming your Product model is not already synced, run:
manage.py syncdb
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 django-shop-categories can be found here: https://github.com/fivethreeo/django-shop-example
Metadata
Release files for django-shop-categories 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-shop-categories-1.0.zip | 17.6 kB | Without provenance | Details for django-shop-categories-1.0.zip |
Release files / django-shop-categories-1.0.zip
| Download URL | django-shop-categories-1.0.zip |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a07f2b1198081bacf7ff7efa333c2b30f6e3bcd42ee3868c8032e8e4f0eb52cc
|
|
BLAKE2b-256 checksum How to use checksums |
89d140d7d8200697372a2a09dbe89a6f47452d8708024a1c1fcbed6689c87942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-shop-categories 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.