Skip to content
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

Use set_password() when creating user in factory #543

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

arturtamborski
Copy link
Member

@arturtamborski arturtamborski commented Aug 19, 2020

Trivial fix for situation when developer runs multiple times make populate-database.
Instead of relying on the previous password (which will be encrypted the second time someone runs this command) use the password defined in factory class because it stays constant.

@@ -39,7 +38,7 @@ class Meta:
def _create(cls, model_class, *args, **kwargs):
groups = kwargs.pop("groups", [])
user = super()._create(model_class, *args, **kwargs)
user.password = make_password(user.password)
user.set_password(cls.password)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that you found that 👍

@arturtamborski arturtamborski merged commit 4fe011b into CodeForPoznan:master Aug 20, 2020
@arturtamborski arturtamborski deleted the set-password branch August 20, 2020 20:46
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.

2 participants