Skip to content
Snippets Groups Projects
Verified Commit 11ba0c79 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix preferences view

- Use new objectgetter_optional
- Fix template
parent 1d214fc1
No related branches found
No related tags found
No related merge requests found
Pipeline #1899 failed
......@@ -9,7 +9,7 @@
{% for section in registry.section_objects.values %}
<li class="tab">
<a class="{% if active_section == section.name %}active{% endif %}"
href="{% url registry_url section %}"
href="{% url registry_url section.name %}"
target="_self">
{{ section.verbose_name }}
</a>
......
......@@ -413,14 +413,14 @@ def preferences(request: HttpRequest, registry_name: str = "person", pk: Optiona
raise PermissionDenied()
elif registry_name == "person":
registry = person_preferences_registry
instance = get_person_by_pk(request, pk)
instance = objectgetter_optional(Person, "request.user.person", True)(request, pk)
form_class = PersonPreferenceForm
if not request.user.has_perm("core.change_person_preferences", instance):
raise PermissionDenied()
elif registry_name == "group":
registry = group_preferences_registry
instance = get_group_by_pk(request, pk)
instance = objectgetter_optional(Group)(request, pk)
form_class = GroupPreferenceForm
if not request.user.has_perm("core.change_group_preferences", instance):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment