Comments (9)
I have the same issue. In settings.py I'm using:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/home/rosshartshorn/htdocs/sqlitedir/sqlite3db',
...along with:
from mongoengine import *
DBNAME = 'gogoworld'
CONNECTION = connect(DBNAME)
...and also:
AUTHENTICATION_BACKENDS = (
'mongoengine.django.auth.MongoEngineBackend',
'django.contrib.auth.backends.ModelBackend'
)
...and also:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
#'mongoengine.django.mongo_auth',
'sourcedocs',
'mongoadmin',
'django.contrib.admin',
...and then in my admin.py I'm using:
from mongoadmin import site, DocumentAdmin
from nouns.models import Noun, Person, Place, Event, Word
class NounAdmin(DocumentAdmin):
pass
site.register(Noun, NounAdmin)
class PersonAdmin(DocumentAdmin):
pass
site.register(Person,PersonAdmin)
class PlaceAdmin(DocumentAdmin):
pass
site.register(Place,PlaceAdmin)
class EventAdmin(DocumentAdmin):
pass
site.register(Event,EventAdmin)
class WordAdmin(DocumentAdmin):
pass
site.register(Word,WordAdmin)
...and I was thinking this would all allow me to login using the sqlite3 for the authentication only, then use mongoadmin for the rest of my models. It is apparent I have done something wrong. I can get to the admin site just fine, but it says "You have no permissions to edit anything".
Did you ever figure out your solution to this problem?
from django-mongoadmin.
Nope. It works very fine for me and I can only fix things I can reproduce or have enough information about.
But this
AUTHENTICATION_BACKENDS = (
'mongoengine.django.auth.MongoEngineBackend',
'django.contrib.auth.backends.ModelBackend'
)
seems to use both auth methods and tries the mongoengine backend first I think. If your user comes from mongoengine you will probably run into permission problems. If you don't need mongoengine users there's no need to use the auth backend.
And I'm not sure if you did set the MONGOADMIN_OVERRIDE_ADMIN
option in your settings.py. If you didn't and have no normal models you will see the same message because Django didn't find anything to edit.
from django-mongoadmin.
Thanks for your response. I removed the AUTHENTICATION_BACKENDS and turned MONGOADMIN_OVERRIDE_ADMIN back on. You are probably correct that this is the source of the "don't have permission to edit", but now I get the following error:
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/admin.py" in
- admin.site.register(Group, GroupAdmin)
File "/usr/local/lib/python2.7/dist-packages/mongoadmin-0.2-py2.7.egg/mongoadmin/sites.py" in register -
File "/usr/local/lib/python2.7/dist-packages/mongoadmin-0.2-py2.7.egg/mongoadmin/validation.py" in
from mongoadmin.validation import validate
- from django.contrib.admin.validation import validate as django_validate
Exception Type: ImportError at /admin/
Exception Value: cannot import name validate
...I am using python 2.7, Django 1.6.0.
I really appreciate your help!
from django-mongoadmin.
Django 1.6 changed a lot in the admin and there isn't a release yet that works with Django 1.6. However the most current version here on github in the master branch should work with Django 1.6. Validation isn't there yet but that shouldn't really matter if you take a bit of care with your admin setups. It is also not as well tested but most of the test cases (which are in a simple Django app, so no automatic tests) I collected over time seem to work. I decided a a rewrite with a lot more inheritance was in order though.
So, in short: Use an installation from github and report any problems please. Just to be on the safe side here are the steps to install and use the github version:
# mongodbforms does most of the heavy lifting and handles forms
pip install --upgrade git+https://github.com/jschrewe/django-mongodbforms.git#mongodbforms
# and after run
pip install --upgrade git+https://github.com/jschrewe/django-mongoadmin.git#mongoadmin
That should give you a working version. Sorry for being late with the version update, but mongoadmin has accumulated quite a bit of (useless or badly written) junk over time which needs a bit of cleanup.
from django-mongoadmin.
I will have another crack at this as well, with 1.6. I had to roll my own solution in the end, as could not get this working.
from django-mongoadmin.
Well, we have progress, as now I am able to see Groups, Users, Sites (the stuff that I put into a sqlite3 db). However, I'm still not seeing the contents of the Mongo db. Does my admin.py above look correct?
It's been about a year since I set up a Django site (even non-Mongo), so it could be I'm forgetting something about how to get stuff showing in the admin site, but I thought the admin.py was enough to do it.
I really appreciate your help, jschrewe, and acron0 please let us know what happens on your end.
from django-mongoadmin.
Probably obvious but easy to forget: Did you add your app with admins and documents to the INSTALLED_APPS?
The autodiscover works by importing every app in INSTALLED_APPS and then importing .admin. If it's not in there nothing is gonna happen.
from django-mongoadmin.
Ha! And I am an idiot. I was so caught up in looking at the mongoadmin related parts, I forgot to put the app into the INSTALLED_APPS. My admin site now works! Thanks very much, I'm very excited that it's now working!
By the way, is your amazon wishlist still up to date? :)
from django-mongoadmin.
Awesome! And I think I "debugged" several mongo related libs several times until I figured out that I made some simple configuration mistake. I guess it's quite an easy thing to get wrong.
And yes, the amazon list is still up to date (although I still need to read a couple books, so not a lot gets added).
from django-mongoadmin.
Related Issues (20)
- Circular Import Error HOT 1
- cannot import name LOOKUP_SEP
- cannot import name MAX_SHOW_ALL_ALLOWED HOT 9
- Maximum recursion exceeded with a ReferenceField('self') in Document HOT 1
- Crash when there is no relational database at all HOT 7
- `raw_id_fields` crashing HOT 22
- ImportError: No module named 'mongoadmin.contenttypes' HOT 1
- TypeError: patch_document() got an unexpected keyword argument 'bound' HOT 7
- Exceptions using mongoadmin.auth and mongoadmin.form HOT 4
- 'DatabaseWrapper' object has no attribute 'Database' HOT 3
- 'PermissionManager' object has no attribute 'clone' HOT 3
- AttributeError: 'module' object has no attribute 'User'
- Please, example app with preconfigured settings
- mongo importerror: cannot import name get_verbose_name HOT 3
- clear HOT 2
- ImportError: cannot import name 'update_wrapper' HOT 1
- patch to fix saving error related to missing new_objects attribute HOT 1
- I get an error when I start server
- Django version 1.9 above, we are getting this problem HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-mongoadmin.