From 621ca5791ff9da76efa0320c0e2278ac284e98f4 Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 5 Apr 2021 08:35:00 -0300 Subject: [PATCH] More docs to the json datatype --- docs/source/usage.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/source/usage.rst b/docs/source/usage.rst index e1f1fa1..98143a6 100644 --- a/docs/source/usage.rst +++ b/docs/source/usage.rst @@ -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") + , ]> + Finally, attribute type *object* allows to relate Django model instances via generic foreign keys: