Profile view permissions

This commit is contained in:
Tobias Kunze 2025-03-20 17:01:47 +01:00
parent 832d85b7fc
commit d10ba90b4d
2 changed files with 7 additions and 4 deletions

View file

@ -10,10 +10,10 @@
<td>
{{ form.instance.name }}
{% if has_change_permission %}
<button class="btn btn-primary"
hx-get="{{ request.path }}?fragment=org-name-edit&hx-single-field=name"
hx-target="closest td"
hx-swap="outerHTML">{% translate "Edit" %}</button>
<button class="btn btn-primary"
hx-get="{{ request.path }}?fragment=org-name-edit&hx-single-field=name"
hx-target="closest td"
hx-swap="outerHTML">{% translate "Edit" %}</button>
{% endif %}
</td>
{% endpartialdef org-name %}

View file

@ -19,6 +19,9 @@ class ProfileView(HtmxUpdateView):
fragments = ("user-email", "user-email-edit", "user-company", "user-company-edit")
model = User
def has_permission(self):
return True
def get_object(self):
return self.request.user