From 7ec81133d8a4486f44ce6a1fc759185969c8d44a Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 9 Feb 2026 22:33:30 +0000 Subject: [PATCH] Allow any authenticated user to create new Structure entries in autocomplete --- atlas/views.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/atlas/views.py b/atlas/views.py index 3d8fbd7a..c4690349 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -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):