Make admin_user & admin_client fixtures compatible with custom user models #885
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces PR #843 with some minor updates. Commits by @jnns.
Using the
admin_client
fixture with a custom user model that doesn't have a username field doesn't work currently. The fixture assumes that the user model always has ausername
field present. For this case, Django hasUser.USERNAME_FIELD
andUser.get_username()
.Unfortunately, the existing test didn't catch this issue because a custom user model with
User.username
is used.This pull request changes the test setup to use a custom user without
username
and makesadmin_client
useUser.get_username()
.There are a few merge requests and issues about this problem already. I hope this one meets the requirements to be merged. If not, please let me know and I see what I can do.
Closes #246
Closes #484
Closes #748
Fixes #457