Allow any authenticated user to create new Structure entries in autocomplete

This commit is contained in:
Ross
2026-02-09 22:33:30 +00:00
parent c67db4a39e
commit 7ec81133d8
+15
View File
@@ -3005,6 +3005,21 @@ class StructureAutocomplete(autocomplete.Select2QuerySetView):
return Structure.objects.none()
return qs
def has_add_permission(self, request):
"""Allow any authenticated user to create new Structure entries.
By default DAL requires the user to have the model add permission.
For Anatomy question creation we want any registered user to be
able to create structures, so relax that check to only require
authentication.
"""
try:
auth = request.user.is_authenticated
except Exception:
auth = False
return bool(auth)
class SubspecialtyAutocomplete(autocomplete.Select2QuerySetView):