I am using a Django installation with MongoEngine to get MongoDB to work as my project's backend.
I've got the implementation to work but am stuck with Django Rest Framework's authentication system. Was just reading the API guide for their authentication
chapter and was trying out their TokenAuthentication
.
Tokens are created using
t = Token.objects.create(user=..)
and it expects a Django User
instance. Since I am using MongoEngine, my database entry in the settings.py
file is set to Dummy.
So how do I create a user
instance that can be used by Token class.
I tried creating users using MongoEngine's mongoengine.django.auth
but the Token class isn't accepting this object.
The resulting error is:
ValueError: Cannot assign "<User: gaurav>": "Token.user" must be a "User" instance.
Please let me know how I can get this to work.