From 7096e97c3961e42e97291c0eedd18b17f40cf908 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 9 Nov 2023 18:09:10 +0100 Subject: [PATCH] disable form of user profile --- idhub/templates/idhub/user/profile.html | 5 ----- idhub/user/views.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/idhub/templates/idhub/user/profile.html b/idhub/templates/idhub/user/profile.html index da1597a..fe5d6e8 100644 --- a/idhub/templates/idhub/user/profile.html +++ b/idhub/templates/idhub/user/profile.html @@ -31,11 +31,6 @@ {% endif %} {% bootstrap_form form %} -
- {% translate "Cancel" %} - -
-
diff --git a/idhub/user/views.py b/idhub/user/views.py index 11f43ab..16df7b9 100644 --- a/idhub/user/views.py +++ b/idhub/user/views.py @@ -47,6 +47,16 @@ class ProfileView(MyProfile, UpdateView): def get_object(self): return self.request.user + def get_form(self): + form = super().get_form() + form.fields['first_name'].disabled = True + form.fields['last_name'].disabled = True + form.fields['email'].disabled = True + return form + + def form_valid(self, form): + return super().form_valid(form) + class RolesView(MyProfile, TemplateView): template_name = "idhub/user/roles.html"