mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-04-21 15:34:45 +00:00
Added docstring in model
This commit is contained in:
parent
e915a95f06
commit
e71123028c
1 changed files with 16 additions and 0 deletions
16
models.py
16
models.py
|
|
@ -139,6 +139,22 @@ class EavAttribute(models.Model):
|
|||
|
||||
|
||||
class EavValue(models.Model):
|
||||
'''
|
||||
The V model in E-A-V. This holds the 'value' for an attribute and an
|
||||
entity:
|
||||
|
||||
>>> from django.db import models
|
||||
>>> from django.contrib.auth.models import User
|
||||
>>> from .utils import EavRegistry
|
||||
>>> EavRegistry.register(User)
|
||||
>>> u = User.objects.create(username='crazy_dev_user')
|
||||
>>> a = EavAttribute.objects.create(name='Favorite Drink', datatype='text',
|
||||
... slug='fav_drink')
|
||||
>>> EavValue.objects.create(entity=u, attribute=a, value_text='red bull')
|
||||
<EavValue: crazy_dev_user - Favorite Drink: "red bull">
|
||||
|
||||
'''
|
||||
|
||||
class Meta:
|
||||
unique_together = ('entity_ct', 'entity_id', 'attribute',
|
||||
'value_text', 'value_float', 'value_date',
|
||||
|
|
|
|||
Loading…
Reference in a new issue