diff options
Diffstat (limited to 'ishtar_common/serializers.py')
-rw-r--r-- | ishtar_common/serializers.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ishtar_common/serializers.py b/ishtar_common/serializers.py index 6d25efdb6..03433df89 100644 --- a/ishtar_common/serializers.py +++ b/ishtar_common/serializers.py @@ -161,7 +161,7 @@ def generic_get_results(model_list, dirname, no_geo=True): new_result += result_to_add result[key] = json.dumps(new_result, indent=2) - excluded_fields = [] + excluded_fields = ["history_modifier", "history_creator"] if hasattr(model, "SERIALIZATION_EXCLUDE"): excluded_fields = list(model.SERIALIZATION_EXCLUDE) if no_geo: @@ -269,6 +269,20 @@ def geo_serialization(archive=False, return_empty_types=False, return full_archive +DIRECTORY_MODEL_LIST = [ + models.Organization, models.Person, models.Author +] + + +def directory_serialization(archive=False, return_empty_types=False, + archive_name=None): + result = generic_get_results(DIRECTORY_MODEL_LIST, "common_directory") + full_archive = archive_serialization( + result, archive_dir="common_directory", archive=archive, + return_empty_types=return_empty_types, archive_name=archive_name) + return full_archive + + def restore_serialized(archive_name, delete_existing=False): with zipfile.ZipFile(archive_name, "r") as zip_file: # check version @@ -280,9 +294,11 @@ def restore_serialized(archive_name, delete_existing=False): ) DIRS = ( - ("types", [None]), ("common_configuration", CONF_MODEL_LIST), + ("types", [None]), + ("common_configuration", CONF_MODEL_LIST), ("common_imports", IMPORT_MODEL_LIST), - ("common_geo", GEO_MODEL_LIST) + ("common_geo", GEO_MODEL_LIST), + ("common_directory", DIRECTORY_MODEL_LIST), ) namelist = zip_file.namelist() for current_dir, model_list in DIRS: |