Skip to main content

Django shop attributes apps

Project description

# MP-Shop | Attributes

## Installation

### Install using PIP:
```
pip install django-mp-shop-attrs
```

### Add attributes to settings.py:
```
INSTALLED_APPS = [
...
'attributes',
]
```

### Add attributes to product admin:
```
from attributes.admin import ProductAdminMixin
from attributes.forms import ProductFormMixin

class ProductForm(ProductFormMixin, forms.ModelForm):
...

class ProductAdmin(ProductAdminMixin, ModelAdmin):

form = ProductForm
...

```

## Usage

```
product = Product.objects.get(...)

for attr_val in product.attr_values.visible():

print(attr_val.attr.name)
print(attr_val.value)

attr_val.value = 'example'
attr_val.save()
```

## Custom product models

```
from django.apps import AppConfig

from attributes import AttributesAppConfig


class CustomAttributesAppConfig(AttributesAppConfig):

product_model = 'custom_app.CustomProductModel'
product_category_model = 'custom_app.CustomProductCategoryModel'
```

settings.py
```
INSTALLED_APPS = [
...
'CustomAttributesAppConfig',
]
```

### App requires this packages:
* django
* awesome-slugify

### App compatible with:
* django-modeltranslation
* django-mptt
* django-suit

### Screenshots
Attributes list
![Attrs list](https://user-images.githubusercontent.com/4138122/41437785-1867b074-702e-11e8-940f-504cae19ca22.png)

Attribute change
![Attr change](https://user-images.githubusercontent.com/4138122/41437857-444bd580-702e-11e8-9340-72c301582695.png)

Project details


Download files

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

Source Distribution

django-mp-shop-attrs-1.2.tar.gz (10.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page