-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
admin_user doesn't like django_username_field being set to email #493
Comments
I have the same problem. |
Did you find a solution for this? |
I overrode the admin_user fixture in conftest.py, you just declare a function there with the same name. Mine looks like:
|
Yeah, I also overwrote it. Easy enough to do. It looks like the authors of pytest-django took the effort of making it work for the case where username=email, but then in practice, this doesn't work. |
The code was changed in this regard: https://github.com/blueyed/pytest-django/blob/33617687f185fecf04bf4bdd99017289078f52df/pytest_django/fixtures.py#L261-L262 Via a3dc56d So I assume this (or at least the original issue) is fixed? |
In my case I actually had an adapted So, your code change is indeed better, but does not cover the case when you have no username field. Which is moot anyway, because you can't cover all custom cases of course. Thanks for the follow up. |
I'm using https://github.com/tmm/django-username-email which uses the email in place of having a separate user name, this generally works well but it breaks the admin_user fixture because this:
leads to this
raising this
The text was updated successfully, but these errors were encountered: