disable form of user profile

This commit is contained in:
Cayo Puigdefabregas 2023-11-09 18:09:10 +01:00
parent 35d7f014be
commit 7096e97c39
2 changed files with 10 additions and 5 deletions

View File

@ -31,11 +31,6 @@
</div>
{% endif %}
{% bootstrap_form form %}
<div class="form-actions-no-box">
<a class="btn btn-secondary" href="{% url 'idhub:user_profile' %}">{% translate "Cancel" %}</a>
<input class="btn btn-success" type="submit" name="submit" value="{% translate 'Save' %}" />
</div>
</form>
<hr />

View File

@ -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"