mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-03-16 22:40:26 +00:00
More docs to the json datatype
This commit is contained in:
parent
80323b1c87
commit
621ca5791f
1 changed files with 13 additions and 0 deletions
|
|
@ -194,12 +194,25 @@ The attribute type *json* allows to store them in JSON format, which internally
|
|||
"it": "Scopa Verde"
|
||||
})
|
||||
|
||||
prod2 = Product.objects.create(sku='PRD00002', eav__name_intl={
|
||||
"es": "Escoba Roja",
|
||||
"en": "Red Broom"
|
||||
})
|
||||
|
||||
prod3 = Product.objects.create(sku='PRD00003', eav__name_intl={
|
||||
"es": "Escoba Azul",
|
||||
"it": "Scopa Blu"
|
||||
})
|
||||
|
||||
prod.eav.name_intl
|
||||
{'es': 'Escoba Verde', 'en': 'Green Broom', 'it': 'Scopa Verde'}
|
||||
|
||||
type(prod.eav.name_intl)
|
||||
dict
|
||||
|
||||
Product.objects.filter(eav__name_intl__has_key="it")
|
||||
<EavQuerySet [<Product: PRD00001>, <Product: PRD00003>]>
|
||||
|
||||
|
||||
Finally, attribute type *object* allows to relate Django model instances
|
||||
via generic foreign keys:
|
||||
|
|
|
|||
Loading…
Reference in a new issue