From c4dc61f4a454ec5f30e29e0325277055983ca80e Mon Sep 17 00:00:00 2001 From: Milstein Munakami Date: Mon, 17 Jun 2024 15:57:35 -0400 Subject: [PATCH] added Username as ReadOnly field (#49) * disable username change on account creation as well as profile management --------- Co-authored-by: Jim Culbert --- apps/regapp/forms.py | 3 ++- apps/regapp/views/profile.py | 2 ++ kubernetes/regapp/skaffold.yaml | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/regapp/forms.py b/apps/regapp/forms.py index 8e0e202..36aa7af 100644 --- a/apps/regapp/forms.py +++ b/apps/regapp/forms.py @@ -46,7 +46,8 @@ def __init__(self, *args, **kwargs): class CreateAccountForm(forms.Form): username = forms.CharField( max_length=100, - label="Preferred Username" + label="Preferred Username", + widget=forms.TextInput(attrs={"readonly": "readonly"}) ) first_name = forms.CharField( max_length=100, diff --git a/apps/regapp/views/profile.py b/apps/regapp/views/profile.py index 1ce64ca..980958f 100644 --- a/apps/regapp/views/profile.py +++ b/apps/regapp/views/profile.py @@ -64,6 +64,8 @@ def profile(request): if 'email' in request.GET: form = CreateAccountForm(request.GET, initial=data) + form.fields['username'].widget.attrs['readonly'] = True + if form.is_valid(): # Rock beats scissors. Kill any extant update diff --git a/kubernetes/regapp/skaffold.yaml b/kubernetes/regapp/skaffold.yaml index c8f86e2..cea6de4 100644 --- a/kubernetes/regapp/skaffold.yaml +++ b/kubernetes/regapp/skaffold.yaml @@ -21,6 +21,6 @@ build: deploy: kustomize: paths: - - overlays/dev + - overlays/microk8s - kubeContext: nerc-minikube + kubeContext: k8sdev