Overview

Configurable product for Django-shop

This plugin allow you to:

  • Define product types in django admin interface with custom set of fields
  • Add custom fields to products

Supported field types

  • Float field
  • Char field
  • Image field (with preview in admin via sorl.thumbnail)
  • Boolean field (NullBooleanField)

Installation

As per usual PIP operations you can install configurableproduct via one of three ways :

Setup

  • Include 'configurableproduct' in your INSTALLED_APPS

    INSTALLED_APPS = (
        ...
        'configurableproduct',
        ...
    )
    
  • Run the database migrations to create the tables

    python ./manage.py migrate
    

Configuration

  • If you want to use CProduct model directly, set ENABLE_CPRODUCT_ADMIN to True in your settings file.

How to use it

Static Fields

  • If you want to define static fields for all product types (i.e. size, ...):
  • Create a subclass of configurableproduct.models.CProduct
  • Write admin class based on configurableproduct.admin.CProductAdmin

Accessing Fields

  • You can access custom fields via productfloat_set, productchar_set,... as:

    product_object.productchar_set.all()[0].value
    
  • You can access ordered list of custom fields via product_object.field_list property

Products of Type

  • each ProductType has a reverse reference to a list of products that use it to define their Type.

./project/manage.py schemamigration configurableproduct

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.