From 53db317529ab96a2684247c89840508016b25b72 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Mon, 14 Apr 2025 10:43:08 +0200 Subject: [PATCH] Refactoring (rename): UserModel -> User which I'd say is the idiomatic way --- users/forms.py | 14 +++++++------- users/management/commands/send_welcome_email.py | 4 ++-- users/views.py | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/users/forms.py b/users/forms.py index b563ec9..311b522 100644 --- a/users/forms.py +++ b/users/forms.py @@ -22,7 +22,7 @@ def _(x): return x -UserModel = get_user_model() +User = get_user_model() class UserCreationForm(BaseUserCreationForm): @@ -47,11 +47,11 @@ class UserCreationForm(BaseUserCreationForm): self.fields['password2'].help_text = None # "Confirm password" is descriptive enough class Meta: - model = UserModel + model = User fields = ("username",) def clean_username(self): - if UserModel.objects.filter(username=self.cleaned_data['username'], is_active=False).exists(): + if User.objects.filter(username=self.cleaned_data['username'], is_active=False).exists(): raise ValidationError(mark_safe( 'This email is already registered but not yet confirmed. Please check your email for the confirmation ' 'link or