From b3fe436d1bd499da970fbaf80ec3dc151dc80f79 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 25 Mar 2024 17:59:58 +0100 Subject: đŸ”§ default permissions for BiographicalNote MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 1ebb87565..d24944f8d 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -62,6 +62,7 @@ from django.core.exceptions import SuspiciousOperation, ObjectDoesNotExist, \ ValidationError from django.core.files import File from django.core.files.storage import FileSystemStorage +from django.core.management import call_command from django.core.validators import EMPTY_VALUES, MaxValueValidator from django.db import models from django.db.models import Q @@ -1485,6 +1486,12 @@ def get_columns_from_class(cls, table_cols_attr="TABLE_COLS", dict_col_labels=Tr return table_cols, table_cols_label +def migrations_load_data(module_name, migration_filename): + json_path = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2] + [ + module_name, "migrations", migration_filename]) + call_command("loaddata", json_path) + + def create_default_areas(models=None, verbose=False): # can be used on migrations if models are provided if not models: -- cgit v1.2.3