Skip to content

Conversation

gradam
Copy link

@gradam gradam commented May 28, 2017

Allow you to use email as username_field.
Also fixed a bug in an admin_client fixture that was caused by using username=admin_user.username instead of admin_user.get_username().

@JakubSemikSTX
Copy link

JakubSemikSTX commented Aug 9, 2017

When do you expect to merge it with the master? As I am facing the same problem and for now I have to use a forked version from @gradam.

When custom user model had 'email' field set as username filed the fixture was resulting in Error `TypeError: create_superuser() got multiple values for argument 'email'`. Additional checking if `username_field` is not equal to 'email' fixed it.
…d on admin_user instead getting username directly.
…me because we had to use custom email field which was not possible when inheriting from AbstractUser
@codecov-io
Copy link

codecov-io commented Oct 10, 2017

Codecov Report

Merging #484 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #484      +/-   ##
==========================================
+ Coverage   91.92%   91.97%   +0.04%     
==========================================
  Files          33       33              
  Lines        1660     1670      +10     
  Branches      143      143              
==========================================
+ Hits         1526     1536      +10     
  Misses         95       95              
  Partials       39       39
Flag Coverage Δ
#dj110 84.01% <100%> (+0.09%) ⬆️
#dj111 86.16% <100%> (+0.08%) ⬆️
#dj18 84.85% <100%> (+0.09%) ⬆️
#dj19 83.89% <100%> (+0.09%) ⬆️
#dj20 84.31% <100%> (+0.09%) ⬆️
#djmaster 84.31% <100%> (+0.09%) ⬆️
#mysql_innodb 84.31% <100%> (+0.09%) ⬆️
#mysql_myisam 84.25% <100%> (+0.09%) ⬆️
#postgres 87.66% <100%> (+0.07%) ⬆️
#py27 89.28% <100%> (+0.06%) ⬆️
#py34 83.89% <100%> (+0.09%) ⬆️
#py35 84.01% <100%> (+0.09%) ⬆️
#py36 84.79% <100%> (+0.09%) ⬆️
#sqlite 86.04% <100%> (+0.08%) ⬆️
#sqlite_file 83.89% <100%> (+0.09%) ⬆️
Impacted Files Coverage Δ
tests/test_fixtures.py 100% <100%> (ø) ⬆️
pytest_django/fixtures.py 96.85% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50063c4...7569d79. Read the comment docs.

@gradam
Copy link
Author

gradam commented Feb 27, 2018

Do you need anything else for this to be merged?

jnns added a commit to jnns/pytest-django that referenced this pull request May 19, 2020
jnns added a commit to jnns/pytest-django that referenced this pull request May 19, 2020
The previous test setup inherited from AbstractUser thus MyCustomUser
still had a username field.

The problems people are having when using the admin_client fixture in
combination with a custom user model are due to the username field
not being present.

This change accounts for the more realistic scenario.

See these tickets:
pytest-dev#246
pytest-dev#484
pytest-dev#748
jnns added a commit to jnns/pytest-django that referenced this pull request May 19, 2020
The previous test setup inherited from AbstractUser thus MyCustomUser
still had a username field.

The problems people are having when using the admin_client fixture in
combination with a custom user model are due to the username field
not being present.

This change accounts for the more realistic scenario.

See these tickets:
pytest-dev#246
pytest-dev#484
pytest-dev#748
jnns added a commit to jnns/pytest-django that referenced this pull request May 19, 2020
The previous test setup inherited from AbstractUser thus MyCustomUser
still had a username field.

The problems people are having when using the admin_client fixture in
combination with a custom user model are due to the username field
not being present.

This change accounts for the more realistic scenario.

See these tickets:
pytest-dev#246
pytest-dev#484
pytest-dev#748
jnns added a commit to jnns/pytest-django that referenced this pull request May 19, 2020
The previous test setup inherited from AbstractUser thus MyCustomUser
still had a username field.

The problems people are having when using the admin_client fixture in
combination with a custom user model are due to the username field
not being present.

This change accounts for the more realistic scenario.

See these tickets:
pytest-dev#246
pytest-dev#484
pytest-dev#748
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants