From a3919d5d51d6f2ae168dc7fe36fbe47e25bdec97 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Mon, 22 Nov 2021 21:31:17 +0100 Subject: [PATCH] disable adding new languages --- ki/handlers/update_profile.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ki/handlers/update_profile.py b/ki/handlers/update_profile.py index 884543d..567f153 100644 --- a/ki/handlers/update_profile.py +++ b/ki/handlers/update_profile.py @@ -30,16 +30,10 @@ def update_languages(profile, languages_data): profile_language_ids = [] for language_data in languages_data: - if "id" in language_data["language"]: - language = Language.query.get(language_data["language"]["id"]) - else: - language_name = language_data["language"]["name"] - language = Language.query.filter(Language.name == language_name).first() - - if language is None: - language = Language(id=language_name, name=language_name) - db.session.add(language) + if "id" not in language_data["language"]: + continue + language = Language.query.get(language_data["language"]["id"]) profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile, ProfileLanguage.language == language).first()