From 60d14069d8de352c9d42da4db9e2fff0eb1a327d Mon Sep 17 00:00:00 2001 From: seroy Date: Mon, 17 Jul 2017 20:57:03 +0300 Subject: [PATCH] Updated 'required' attribute in documentation --- README.rst | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index b6628a6..8d0e73e 100644 --- a/README.rst +++ b/README.rst @@ -129,21 +129,42 @@ Constraints **Required/Optional** -At the moment, it is not possible to select two languages to be marked as required. The constraint is **not** enforced on a database level. +Constraints is enforced on a database level. -* Make the primary language **required** and the others optional (this is the **default**): +* Optional filling .. code-block:: python class MyModel(models.Model): - title = LocalizedField(required=True) + title = LocalizedField(blank=True, null=True, required=False) -* Make all languages optional: +* Make translation required for any language .. code-block:: python class MyModel(models.Model): - title = LocalizedField(null=True) + title = LocalizedField(blank=False, null=False, required=False) + +* Make translation required for specific languages + + .. code-block:: python + + class MyModel(models.Model): + title = LocalizedField(blank=False, null=False, required=['en', 'ro']) + +* Make translation required for all languages + + .. code-block:: python + + class MyModel(models.Model): + title = LocalizedField(blank=False, null=False, required=True) + +* By default the primary language **required** and the others optional: + + .. code-block:: python + + class MyModel(models.Model): + title = LocalizedField() **Uniqueness**