-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add default demographic setup to device settings.
When a new facility dataset is created, use default demographic settings if available.
- Loading branch information
Showing
3 changed files
with
222 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
kolibri/core/device/migrations/0021_default_demographic_fields.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.29 on 2024-03-28 15:35 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
import kolibri.core.auth.constants.demographics | ||
import kolibri.core.fields | ||
import kolibri.core.utils.validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("device", "0020_fix_learner_device_status_choices"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="devicesettings", | ||
name="extra_settings", | ||
field=kolibri.core.fields.JSONField( | ||
default={ | ||
"allow_download_on_metered_connection": False, | ||
"allow_learner_download_resources": False, | ||
"enable_automatic_download": True, | ||
"limit_for_autodownload": 0, | ||
"set_limit_for_autodownload": False, | ||
}, | ||
validators=[ | ||
kolibri.core.utils.validators.JSON_Schema_Validator( | ||
{ | ||
"properties": { | ||
"allow_download_on_metered_connection": { | ||
"type": "boolean" | ||
}, | ||
"allow_learner_download_resources": { | ||
"optional": True, | ||
"type": "boolean", | ||
}, | ||
"default_demographic_field_schema": { | ||
"items": { | ||
"properties": { | ||
"description": {"type": "string"}, | ||
"enumValues": { | ||
"items": { | ||
"properties": { | ||
"defaultLabel": { | ||
"type": "string" | ||
}, | ||
"translations": { | ||
"items": { | ||
"properties": { | ||
"language": { | ||
"enum": [ | ||
"ar", | ||
"bg-bg", | ||
"bn-bd", | ||
"de", | ||
"el", | ||
"en", | ||
"es-419", | ||
"es-es", | ||
"fa", | ||
"ff-cm", | ||
"fr-fr", | ||
"gu-in", | ||
"ha", | ||
"hi-in", | ||
"ht", | ||
"id", | ||
"it", | ||
"ka", | ||
"km", | ||
"ko", | ||
"mr", | ||
"my", | ||
"nyn", | ||
"pt-br", | ||
"pt-mz", | ||
"sw-tz", | ||
"te", | ||
"uk", | ||
"ur-pk", | ||
"vi", | ||
"yo", | ||
"zh-hans", | ||
], | ||
"type": "string", | ||
}, | ||
"message": { | ||
"type": "string" | ||
}, | ||
}, | ||
"type": "object", | ||
}, | ||
"optional": True, | ||
"type": "array", | ||
}, | ||
"value": {"type": "string"}, | ||
}, | ||
"type": "object", | ||
}, | ||
"type": "array", | ||
}, | ||
"id": {"type": "string"}, | ||
"translations": { | ||
"items": { | ||
"properties": { | ||
"language": { | ||
"enum": [ | ||
"ar", | ||
"bg-bg", | ||
"bn-bd", | ||
"de", | ||
"el", | ||
"en", | ||
"es-419", | ||
"es-es", | ||
"fa", | ||
"ff-cm", | ||
"fr-fr", | ||
"gu-in", | ||
"ha", | ||
"hi-in", | ||
"ht", | ||
"id", | ||
"it", | ||
"ka", | ||
"km", | ||
"ko", | ||
"mr", | ||
"my", | ||
"nyn", | ||
"pt-br", | ||
"pt-mz", | ||
"sw-tz", | ||
"te", | ||
"uk", | ||
"ur-pk", | ||
"vi", | ||
"yo", | ||
"zh-hans", | ||
], | ||
"type": "string", | ||
}, | ||
"message": {"type": "string"}, | ||
}, | ||
"type": "object", | ||
}, | ||
"optional": True, | ||
"type": "array", | ||
}, | ||
}, | ||
"type": "object", | ||
}, | ||
"optional": True, | ||
"type": "array", | ||
}, | ||
"enable_automatic_download": {"type": "boolean"}, | ||
"limit_for_autodownload": { | ||
"optional": True, | ||
"type": "integer", | ||
}, | ||
"set_limit_for_autodownload": { | ||
"optional": True, | ||
"type": "boolean", | ||
}, | ||
}, | ||
"required": [ | ||
"allow_download_on_metered_connection", | ||
"enable_automatic_download", | ||
], | ||
"type": "object", | ||
} | ||
), | ||
kolibri.core.auth.constants.demographics.UniqueIdsValidator( | ||
"default_demographic_field_schema" | ||
), | ||
kolibri.core.auth.constants.demographics.DescriptionTranslationValidator( | ||
"default_demographic_field_schema" | ||
), | ||
kolibri.core.auth.constants.demographics.EnumValuesValidator( | ||
"default_demographic_field_schema" | ||
), | ||
kolibri.core.auth.constants.demographics.LabelTranslationValidator( | ||
"default_demographic_field_schema" | ||
), | ||
], | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters