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

View file

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