mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-03-16 22:40:26 +00:00
Update README.md
This commit is contained in:
parent
d60614ffb7
commit
92070bfe18
1 changed files with 50 additions and 27 deletions
77
README.md
77
README.md
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
[](https://travis-ci.org/makimo/django-eav2)
|
||||
[](https://coveralls.io/github/makimo/django-eav2?branch=master)
|
||||
[](https://www.codacy.com/app/IwoHerka/django-eav2?utm_source=github.com&utm_medium=referral&utm_content=makimo/django-eav2&utm_campaign=Badge_Grade)
|
||||
|
|
@ -5,41 +6,63 @@
|
|||

|
||||

|
||||
|
||||
### Django EAV 2 - Entity-Attribute-Value storage for Django
|
||||
## Django EAV 2 - Entity-Attribute-Value storage for Django
|
||||
|
||||
#### Introduction
|
||||
Django EAV 2 is a fork of django-eav (which itself was derived from eav-django).
|
||||
You can find documentation <a href="http://django-eav-2.rtfd.io">here</a>.
|
||||
|
||||
Django EAV 2 is a fork of django-eav (which itself was derived from eav-django).
|
||||
This project aims to:
|
||||
## Installation
|
||||
You can install **django-eav2** from three sources:
|
||||
```bash
|
||||
# From PyPI via pip
|
||||
pip install django-eav2
|
||||
|
||||
- add Python 3 support
|
||||
- add Django 1.11 and 2.0 support
|
||||
- modernize and clean-up the codebase
|
||||
- drop Django <1.11 dependencies
|
||||
- remove dependency on Sites framework
|
||||
- fix unresolved issues
|
||||
- update documentation (Sphinx + ReadTheDocs)
|
||||
- create exhaustive (and automated) tests
|
||||
- add new features
|
||||
|
||||
(For now) our progress can be tracked through issues. Feel free
|
||||
to join the discussion.
|
||||
|
||||
### Installing from git
|
||||
|
||||
```
|
||||
# From source via pip
|
||||
pip install git+https://github.com/makimo/django-eav2@master
|
||||
```
|
||||
|
||||
### Installing from source
|
||||
|
||||
```
|
||||
# From source via setuptools
|
||||
git clone git@github.com:makimo/django-eav2.git
|
||||
cd django-eav2
|
||||
python setup.py install
|
||||
```
|
||||
To uninstall:
|
||||
```
|
||||
|
||||
# To uninstall:
|
||||
python setup.py install --record files.txt
|
||||
rm $(cat files.txt)
|
||||
```
|
||||
|
||||
## Getting started
|
||||
|
||||
**Step 1.** Register a model:
|
||||
|
||||
```python
|
||||
import eav
|
||||
eav.register(Supplier)
|
||||
```
|
||||
|
||||
or with decorators:
|
||||
|
||||
```python
|
||||
from eav.decorators import register_eav
|
||||
|
||||
@register_eav
|
||||
class Supplier(models.Model):
|
||||
...
|
||||
```
|
||||
|
||||
**Step 2.** Create an attribute:
|
||||
|
||||
```python
|
||||
Attribute.objects.create(name='City', datatype=Attribute.TYPE_TEXT)
|
||||
```
|
||||
|
||||
**Step 3.** That’s it! You’re ready to go:
|
||||
|
||||
```python
|
||||
supplier.eav.city = 'London'
|
||||
supplier.save()
|
||||
|
||||
Supplier.objects.filter(eav__city='London')
|
||||
# = <EavQuerySet [<Supplier: Supplier object (1)>]>
|
||||
```
|
||||
|
||||
### What next? Check out <a href="http://django-eav-2.rtfd.io">documentation</a>.
|
||||
|
|
|
|||
Loading…
Reference in a new issue