summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2025-06-02 13:27:33 +0000
committerMagnus Hagander2025-06-02 13:27:33 +0000
commitf99f26ef6520b59fc2cba9b777aa6f41fbb1b5ef (patch)
treee1bcab24b70f881af1b6a546dad268678b63bd57
parent37a93e82558f839a7ba1f9cfaa1ff413e35bc198 (diff)
Disable the local part field when it can't be changed
Iẗ́'s silly to have a dropdown you can change and only give an error message later :)
-rw-r--r--pgmailmgr/mailmgr/forms.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pgmailmgr/mailmgr/forms.py b/pgmailmgr/mailmgr/forms.py
index a3c59b7..91ee7bd 100644
--- a/pgmailmgr/mailmgr/forms.py
+++ b/pgmailmgr/mailmgr/forms.py
@@ -62,6 +62,9 @@ class VirtualUserForm(forms.ModelForm):
self.fields['account'] = forms.CharField(max_length=200, widget=AccountEmailWidget(instance.account), required=False)
+ if self.instance.pk:
+ self.fields['local_domain'].disabled = True
+
def clean_local_domain(self):
if not self.instance.pk:
return self.cleaned_data['local_domain']