Skip to content

Commit

Permalink
Merge pull request #2709 from digitalfabrik/bug/fix_error_poi_categor…
Browse files Browse the repository at this point in the history
…y_creation

Fix error when creating a new POI category
  • Loading branch information
MizukiTemma authored Mar 21, 2024
2 parents 47757ba + db97a65 commit bd19b11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ def get_form_kwargs(self, index: int) -> dict[str, dict[str, Language]]:
# Get the relative index of all extra forms
rel_index = index - self.initial_form_count()
# Get all remaining languages
languages = Language.objects.exclude(
id__in=self.instance.translations.values_list("language__id", flat=True)
)
languages = Language.objects.all()
if self.instance.id:
languages = Language.objects.exclude(
id__in=self.instance.translations.values_list(
"language__id", flat=True
)
)
# Assign the language to the form with this index
kwargs["additional_instance_attributes"] = {
"language": languages[rel_index]
Expand Down
2 changes: 2 additions & 0 deletions integreat_cms/release_notes/current/unreleased/2708.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
en: Fix error when creating a new POI category
de: Behebe Fehler bei der Erstellung einer neuen POI-Kategorie

0 comments on commit bd19b11

Please sign in to comment.