I am trying to work through the authentication tutorials to make sure everything works as expected. I entered the following code.
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', '[email protected]', 'johnpassword')
>>> user.last_name = 'Lennon'
>>> user.save()
and I get the error
AppRegistryNotReady: Models aren't loaded yet.
I see from the release notes
The default implementation of
remove()
forForeignKey
related managers changed from a series ofModel.save()
calls to a singleQuerySet.update()
call. The change means thatpre_save
andpost_save
signals aren’t sent anymore. You can use thebulk=False
keyword argument to revert to the previous behaviour.
So I presume it is a foreign key issue.
My question is, where do I use the bulk=False
attribute or is there another solution?
I suggest doing this before your code above:
import django
django.setup()
Does that fix it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With