File tree 3 files changed +21
-16
lines changed
3 files changed +21
-16
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from bolt import forms
4
4
from bolt .auth import authenticate , get_user_model , password_validation
5
- from bolt .auth .models import User
6
5
from bolt .auth .tokens import default_token_generator
7
6
from bolt .db .forms import ModelForm
8
7
from bolt .exceptions import ValidationError
@@ -98,7 +97,7 @@ class BaseUserCreationForm(ModelForm):
98
97
)
99
98
100
99
class Meta :
101
- model = User
100
+ model = get_user_model ()
102
101
fields = ("username" ,)
103
102
field_classes = {"username" : UsernameField }
104
103
@@ -149,7 +148,10 @@ class UserCreationForm(BaseUserCreationForm):
149
148
def clean_username (self ):
150
149
"""Reject usernames that differ only in case."""
151
150
username = self .cleaned_data .get ("username" )
152
- if username and User .objects .filter (username__iexact = username ).exists ():
151
+ if (
152
+ username
153
+ and get_user_model ().objects .filter (username__iexact = username ).exists ()
154
+ ):
153
155
raise forms .ValidationError (self .error_messages ["unique" ], code = "unique" )
154
156
else :
155
157
return username
@@ -166,7 +168,7 @@ class UserChangeForm(ModelForm):
166
168
)
167
169
168
170
class Meta :
169
- model = User
171
+ model = get_user_model ()
170
172
fields = "__all__"
171
173
field_classes = {"username" : UsernameField }
172
174
Original file line number Diff line number Diff line change
1
+ # Generated by Bolt 5.0.dev20240205033503 on 2024-02-05 03:42
2
+
3
+ from bolt .db import migrations
4
+
5
+
6
+ class Migration (migrations .Migration ):
7
+ dependencies = [
8
+ ("auth" , "0002_remove_user_is_superuser" ),
9
+ ]
10
+
11
+ operations = [
12
+ migrations .DeleteModel (
13
+ name = "User" ,
14
+ ),
15
+ ]
Original file line number Diff line number Diff line change @@ -205,15 +205,3 @@ def normalize_username(cls, username):
205
205
if isinstance (username , str )
206
206
else username
207
207
)
208
-
209
-
210
- class User (AbstractUser ):
211
- """
212
- Users within the Bolt authentication system are represented by this
213
- model.
214
-
215
- Username and password are required. Other fields are optional.
216
- """
217
-
218
- class Meta (AbstractUser .Meta ):
219
- swappable = "AUTH_USER_MODEL"
You can’t perform that action at this time.
0 commit comments