I am using mongoengine (v0.9) as a mapper for my Django (v1.8) project running by Python 3.4.
Although I have added following codes to settings.py file, I still keep receiving this error while a user try to connect to admin using django default admin process)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mongoengine.django.mongo_auth',
'myapp',
)
AUTHENTICATION_BACKENDS = ('mongoengine.django.auth.MongoEngineBackend',)
SESSION_ENGINE = 'mongoengine.django.sessions'
connect('mymongodb')
AttributeError at /admin/login/
'MetaDict' object has no attribute 'pk'
Request Method: POST
Request URL: http://myapp.dev:8000/admin/login/
Django Version: 1.8
Exception Type: AttributeError
Exception Value: 'MetaDict' object has no attribute 'pk'
Exception Location: c:\Programs\Python34\lib\site-packages\django\contrib\auth__init__.py in login, line 111
Python Executable: c:\Programs\Python34\python.exe
Python Version: 3.4.2
P.S: I have also tried customizing Login Process by writing URL patterns, template and views, but will get same error on calling "login()" function.
I had a same issue that you guys were having. I created a new github project to resolve my issue. You can download it or modify it or extract code for your own use by going to https://github.com/robintiwari/django-me. Please let me know if you have any questions on how to use it. I also have an example project regarding configuration. To be specific, you should find an answer on this code https://github.com/robintiwari/django-me/blob/master/djangome/mongo_auth/middlewares.py
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