Skip to content

Commit

Permalink
[#23] Fix multiple list entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrie committed Aug 28, 2023
1 parent 3feaf13 commit fc52b41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpmonitor/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_queryset(self, request):
user = request.user
if user.is_superuser:
return qs
return qs.filter(rules.is_allowed_to_edit_q(user, City))
return qs.filter(rules.is_allowed_to_edit_q(user, City)).distinct()

@admin.display(description="")
def edit_tasks(self, city: City):
Expand Down Expand Up @@ -320,7 +320,7 @@ def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "city":
kwargs["queryset"] = City.objects.filter(
rules.is_allowed_to_edit_q(request.user, City)
)
).distinct()
return super().formfield_for_foreignkey(db_field, request, **kwargs)

def get_changeform_initial_data(self, request: HttpRequest):
Expand Down

0 comments on commit fc52b41

Please sign in to comment.