disable adding new languages
This commit is contained in:
parent
9baf08d6b6
commit
a3919d5d51
@ -30,16 +30,10 @@ def update_languages(profile, languages_data):
|
|||||||
profile_language_ids = []
|
profile_language_ids = []
|
||||||
|
|
||||||
for language_data in languages_data:
|
for language_data in languages_data:
|
||||||
if "id" in language_data["language"]:
|
if "id" not in language_data["language"]:
|
||||||
|
continue
|
||||||
|
|
||||||
language = Language.query.get(language_data["language"]["id"])
|
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)
|
|
||||||
|
|
||||||
profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile,
|
profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile,
|
||||||
ProfileLanguage.language == language).first()
|
ProfileLanguage.language == language).first()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user