Skip to content

Commit

Permalink
Change UserModel to User for the model (follow same convention as res…
Browse files Browse the repository at this point in the history
…t of tutorial)
  • Loading branch information
hamishwillee authored Nov 3, 2023
1 parent 4c18bda commit 85bfc7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions files/en-us/learn/server-side/django/authentication/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ Our superuser is already authenticated and has all permissions, so we'll need to
> ```python
> # Get current user model from settings
> from django.contrib.auth import get_user_model
> UserModel = get_user_model()
> User = get_user_model()
>
> # Create user from model and save to the database
> user = UserModel.objects.create_user('myusername', '[email protected]', 'mypassword')
> user = User.objects.create_user('myusername', '[email protected]', 'mypassword')
>
> # Update fields and then save again
> user.first_name = 'Tyrone'
Expand Down
10 changes: 5 additions & 5 deletions files/en-us/learn/server-side/django/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -585,15 +585,15 @@ from django.utils import timezone
# Get user model from settings
from django.contrib.auth import get_user_model
UserModel = get_user_model()
User = get_user_model()
from catalog.models import BookInstance, Book, Genre, Language
class LoanedBookInstancesByUserListViewTest(TestCase):
def setUp(self):
# Create two users
test_user1 = UserModel.objects.create_user(username='testuser1', password='1X<ISRUkw+tuK')
test_user2 = UserModel.objects.create_user(username='testuser2', password='2HJ1vRV0Z&3iD')
test_user1 = User.objects.create_user(username='testuser1', password='1X<ISRUkw+tuK')
test_user2 = User.objects.create_user(username='testuser2', password='2HJ1vRV0Z&3iD')
test_user1.save()
test_user2.save()
Expand Down Expand Up @@ -768,8 +768,8 @@ from django.contrib.auth.models import Permission # Required to grant the permis
class RenewBookInstancesViewTest(TestCase):
def setUp(self):
# Create a user
test_user1 = UserModel.objects.create_user(username='testuser1', password='1X<ISRUkw+tuK')
test_user2 = UserModel.objects.create_user(username='testuser2', password='2HJ1vRV0Z&3iD')
test_user1 = User.objects.create_user(username='testuser1', password='1X<ISRUkw+tuK')
test_user2 = User.objects.create_user(username='testuser2', password='2HJ1vRV0Z&3iD')

test_user1.save()
test_user2.save()
Expand Down

0 comments on commit 85bfc7f

Please sign in to comment.