This commit is contained in:
Egor Matveev
2022-03-19 13:52:56 +03:00
parent 7e79595b2f
commit dd7d61e909
2 changed files with 7 additions and 19 deletions

View File

@@ -18,3 +18,10 @@ class Command(BaseCommand):
obj, _ = LanguageApply.objects.get_or_create(language_id=language.id)
obj.applied = True
obj.save()
language_ids = [language.id for language in languages]
for apply in LanguageApply.objects.all():
if apply.language_id not in language_ids:
for s in Set.objects.filter(languages__in=apply.language_id):
s.languages.remove(apply.language_id)
s.save()
apply.delete()