#26445: Can't set password on User during migration that depends on contrib.auth -------------------------------------+------------------------------------- Reporter: giuliettamasina | Owner: | giuliettamasina Type: Bug | Status: closed Component: Migrations | Version: 1.9 Severity: Normal | Resolution: invalid Keywords: | Triage Stage: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by knbk):
* status: assigned => closed * resolution: => invalid Comment: It is expected behaviour that these methods are not available in your migrations. The reason is shortly explained in [https://docs.djangoproject.com/en/1.9/topics/migrations/#historical- models Historical models]: arbitrary code can't be serialized, so there is no general way to make the historical methods available in your migrations. To avoid this problem you can use the `make_password` function directly and set the hashed password on your user: {{{ from django.contrib.auth.hashers import make_password user.password = make_password('password') }}} -- Ticket URL: <https://code.djangoproject.com/ticket/26445#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/073.fb096cc16a023c0ff45c19ae57222807%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.