Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing update rights for Infrastructure Condition and Infrastructure Type with no structure #3748

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ CHANGELOG
- Upgrade `django-mapentity` to 8.6.1. New authentication system for screamshotter and convertit by token instead of IP detection.
- Refactor code for accessibility attachments

**Bug fixes**

- Fix missing update rights for Infrastructure Condition and Infrastructure Type with no structure in Admin Site (#3747)


2.100.2 (2023-09-12)
------------------------
Expand Down
5 changes: 3 additions & 2 deletions geotrek/infrastructure/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from django.db.models import Q

from geotrek.common.mixins.actions import MergeActionMixin
from geotrek.infrastructure.models import InfrastructureAccessMean, InfrastructureMaintenanceDifficultyLevel, InfrastructureType, InfrastructureCondition, InfrastructureUsageDifficultyLevel
Expand All @@ -15,7 +16,7 @@ def get_queryset(self, request):
"""
qs = super().get_queryset(request)
if not request.user.has_perm('authent.can_bypass_structure'):
qs = qs.filter(structure=request.user.profile.structure)
qs = qs.filter(Q(structure=request.user.profile.structure) | Q(structure=None))
return qs

def formfield_for_foreignkey(self, db_field, request, **kwargs):
Expand Down Expand Up @@ -51,7 +52,7 @@ def get_queryset(self, request):
"""
qs = super().get_queryset(request)
if not request.user.has_perm('authent.can_bypass_structure'):
qs = qs.filter(structure=request.user.profile.structure)
qs = qs.filter(Q(structure=request.user.profile.structure) | Q(structure=None))
return qs

def formfield_for_foreignkey(self, db_field, request, **kwargs):
Expand Down