jschrewe / django-mongoadmin Goto Github PK
View Code? Open in Web Editor NEWIntegrates mongodb into django's admin
Home Page: http://www.schafproductions.com/projects/mongo-admin/
License: BSD 3-Clause "New" or "Revised" License
Integrates mongodb into django's admin
Home Page: http://www.schafproductions.com/projects/mongo-admin/
License: BSD 3-Clause "New" or "Revised" License
Hi guys!
MAX_SHOW_ALL_ALLOWED was removed in favor or ChangeList.list_max_show_all since Django changeset #16725
Very nice project!!
I was getting the error "'StringField' object has no attribute 'document_type'"
Commenting out lines 341-361 of options.py resulted in getting the admin to work (although probably not the best thing to do, I'm guessing).
Hi,
I tried to use raw_id_fields
in the admin classes, but it failed (see the stacktrace).
Reading your code (in validation.py), what I don't understand is that raw_id_fields
is tested against Django's ManyToMayField
and ForeignKey
, which will obviously fail because in mongoengine we don't have these fields.
Is it just a matter of replacing them with ReferenceField
and GenericReferenceField
or is it much more complicated than that ?
regards,
-e [email protected]:jschrewe/django-mongoadmin.git@5d4db8d1f51db19837250f2018cfca4d25fe77e7#egg=mongoadmin-master
Getting this error, when click on "add" link
Environment:
Request Method: GET
Request URL: http://localhost:8000/wfe/admin/home/wfspec/add/
Django Version: 1.6
Python Version: 2.7.4
Installed Applications:
('django.contrib.contenttypes',
'django.contrib.auth',
'mongoengine.django.mongo_auth',
'django.contrib.sessions',
'mongoadmin',
'django.contrib.admin',
'django.contrib.messages',
'django.contrib.staticfiles',
'djcelery',
'home',
'django_extensions',
'mongoengine.django.mongo_auth',
'django_ses',
'djangular')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django_extensions.middlewares.ForceDefaultLanguageMiddleware')
Traceback:
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
430. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
99. response = view_func(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
52. response = view_func(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
198. return view(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
29. return bound_func(*args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
99. response = view_func(request, *args, **kwargs)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
25. return func(self, *args2, **kwargs2)
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
338. with self:
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/transaction.py" in __enter__
237. if not connection.get_autocommit():
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/backends/__init__.py" in get_autocommit
324. self.ensure_connection()
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/backends/__init__.py" in ensure_connection
124. self.connect()
File "/home/german/a/work/wfe/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
86. db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)
Exception Type: AttributeError at /wfe/admin/home/wfspec/add/
Exception Value: 'DatabaseWrapper' object has no attribute 'Database'
Could you please, create an example app with preconfigured settings - i have a lot of different error trying to add mongoadmin to my app. Also i tried django-mongonaut - no lock too
python 3.4.3
Django (1.7.4)
mongoadmin (0.2)
mongodbforms (0.3)
mongoengine (0.10.0)
pymongo (3.1)
mongoadmin
into settings.py,INSTALLED_APPS = (
'mongoadmin',
'django.contrib.admin',
)
it happens an error:
Traceback (most recent call last):
File "manage.py", line 20, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/mongoadmin/__init__.py", line 1, in <module>
from .options import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/mongoadmin/options.py", line 26, in <module>
from django.utils.functional import update_wrapper
ImportError: cannot import name 'update_wrapper'
Traceback (most recent call last):
File "manage.py", line 8, in
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/usr/local/lib/python2.7/dist-packages/mongoadmin/init.py", line 1, in
from .options import *
File "/usr/local/lib/python2.7/dist-packages/mongoadmin/options.py", line 6, in
from mongoadmin.contenttypes.models import ContentType
File "/usr/local/lib/python2.7/dist-packages/mongoadmin/contenttypes/models.py", line 1, in
from .utils import has_rel_db, get_model_or_document
File "/usr/local/lib/python2.7/dist-packages/mongoadmin/contenttypes/utils.py", line 5, in
from django.contrib.contenttypes.models import ContentType
File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py", line 138, in
class ContentType(models.Model):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 105, in new
app_config = apps.get_containing_app_config(module)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 237, in get_containing_app_config
self.check_apps_ready()
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
The prefix for for fields that have choices in embedded documents does get generated correctly on formset generation.
Followed the documentation down to the dot and stumbled upon a circular import error:
Cannot import name site
It shows up while executing this import statement inside admin.py of my app.
from mongoadmin import site, DocumentAdmin
Hi, I'm trying to add mongoadmin to my app, and fails trying to import the User model.
This is my setup:
pip freeze
Django==1.6.1
mongoadmin==0.2
mongodbforms==0.3
mongoengine==0.8.6
pymongo==2.6.3
...
settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'mongoengine.django.mongo_auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mongodbforms', # https://github.com/jschrewe/django-mongodbforms
'mongoadmin', # https://github.com/jschrewe/django-mongoadmin
'django.contrib.admin',
...
)
AUTH_USER_MODEL = 'mongo_auth.MongoUser'
MONGOADMIN_OVERRIDE_ADMIN = True
# mongoengine auth config.
AUTHENTICATION_BACKENDS = (
'mongoengine.django.auth.MongoEngineBackend',
)
# mongoengine session config.
SESSION_ENGINE = 'mongoengine.django.sessions'
SESSION_SERIALIZER = 'mongoengine.django.sessions.BSONSerializer'
If I remove mongoadmin from INSTALLED_APPS everything run OK, else I get this stacktrace:
Traceback (most recent call last):
File "manage.py", line 26, in <module>
execute_from_command_line(sys.argv)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoadmin/__init__.py", line 1, in <module>
from .options import *
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoadmin/options.py", line 6, in <module>
from mongoadmin.contenttypes.models import ContentType
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoadmin/contenttypes/models.py", line 9, in <module>
from mongoengine.django.auth import ContentType
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoengine/django/auth.py", line 12, in <module>
from .mongo_auth.models import get_user_document
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoengine/django/mongo_auth/models.py", line 96, in <module>
class MongoUser(models.Model):
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/db/models/base.py", line 144, in __new__
new_class.add_to_class(obj_name, obj)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/django/db/models/base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoengine/django/mongo_auth/models.py", line 66, in contribute_to_class
self.model = get_user_document()
File "/home/maxicecilia/.virtualenvs/dnd-tools/local/lib/python2.7/site-packages/mongoengine/django/mongo_auth/models.py", line 29, in get_user_document
return getattr(module, name[dot + 1:])
AttributeError: 'module' object has no attribute 'User'
Any ideas? Thanks!
This is at the moment patched to work just like it did in Django 1.3. The current fix is in views.py#55-60.
See release notes https://docs.djangoproject.com/en/dev/releases/1.4/#list-filters-in-admin-interface
I ran into this error when enabling mongoadmin in the INSTALLED_APPS array.
Django==1.4
MySQL-python==1.2.3
django-admin-tools==0.4.1
django-debug-toolbar==0.9.4
django-extensions==0.8
mongoadmin==0.1.3
mongodbforms==0.1.4
mongoengine==0.6.10
pymongo==2.2
wsgiref==0.1.2
I really, really want to use this.
I have a skeleton project with the following installed (on Ubuntu 12.10):
django-mongodbforms
Django 1.4.3
Pymongo 2.4.1
Mongoengine 0.7.9
I'm not using Mongoengine for Auth, so I have a tiny SQLite db just to power the admin interface. After following the Usage steps, I log into /admin and just get "You don't have permission to edit anything". Obviously, none of my models are listed. If I revert back to admin.site urls it works fine (I can see Users, Sites etc) but minus the Mongoengine Documents...
ImportError: cannot import name LOOKUP_SEP
options.py line 14
moved from django.db.models.sql.constants to django.db.models.constants
When I have added "mongoadmin" to INSTALLED_APPS = () and tried to start dev server, it's giving this error:
Error: No module named objectid
Django 1.4 and venv
Hey,
I'm trying to setup some inherited documents in my db, and I'm having some issues with viewing the base class in mongoadmin.
Here is my code:
Admin.py:
class ActivityAdmin(DocumentAdmin):
model = BaseActivity
list_display = ('date_created', 'creator', 'targets',)
class FanActivityAdmin(DocumentAdmin):
#model = FanActivity
#list_display = ('date_created', 'creator', 'targets',)
pass
class EventActivityAdmin(DocumentAdmin):
#model = EventActivity
#list_display = ('date_created', 'creator', 'targets',)
pass
class VenueActivityAdmin(DocumentAdmin):
#model = VenueActivity
#list_display = ('date_created', 'creator', 'targets',)
pass
class ArtistActivityAdmin(DocumentAdmin):
#model = ArtistActivity
#list_display = ('date_created', 'creator', 'targets',)
pass
site.register(FanActivity, FanActivityAdmin)
site.register(EventActivity, EventActivityAdmin)
site.register(VenueActivity, VenueActivityAdmin)
site.register(ArtistActivity, ArtistActivityAdmin)
site.register(BaseActivity, ActivityAdmin)
Models.py:
class BaseActivity(BaseDocument):
creator = EmbeddedDocumentField('Creator')
targets = ListField(EmbeddedDocumentField('Target'))
meta = {'allow_inheritance' : True, 'queryset_class' : BaseActivityManager}
class FanActivity(BaseActivity):
#_admin_opts = BaseActivity
pass
class ArtistActivity(BaseActivity):
#_admin_opts = ArtistActivityAdmin
pass
class VenueActivity(BaseActivity):
# _admin_opts = VenueActivityAdmin
pass
class EventActivity(BaseActivity):
#_admin_opts = EventActivityAdmin
pass
This is the error I get when I try to go to /mongoadmin/activity/baseactivity:
AttributeError at /mongoadmin/activity/baseactivity/
'FanActivity' object has no attribute '_admin_opts'
Now, when I try to uncomment the _admin_opts attribute to the models, here is what I get:
AttributeError at /mongoadmin/activity/baseactivity/
type object 'BaseActivity' has no attribute 'get_field_by_name'
What am I doing wrong??
Thanks for your help!
Rehello !
I run Python 3.3.2 with Django 1.5.4, MongoEngine 0.8.4 and Windows XP 32bit.
When I want to run the django development server, I got this error.
After some search in your code, I found the reference to "patch_document" in contenttypes.models.
It seems in mongodbforms 0.2.2, there is no third parameter called "bound". I tried to remove these parameters for your calls and it seems to work.
Another error can be raised : "Attribute Error: " with no message.
It is because the "ContentTypeManager" in django.contrib.contenttypes.models has no "contribute_to_class" method.
[mongoadmin.contenttypes.models] Line 25: super(ContentTypeManager, self).contribute_to_class(model, name)
raises this error. I comment this line and the development server starts, but I don't really know what this method must do.
I hope it will help you to improve django-mongoadmin ! ๐
Regards,
Choko256
Hello
I have added the user model to admin but I get error when trying to add or edit a user.
from mongoengine.django.auth import User
from mongoadmin import site, DocumentAdmin
class UserAdmin(DocumentAdmin):
pass
site.register(User, UserAdmin)
comment those lines and run and i can edit users.
AttributeError at /admin/django/user/add/
type object 'User' has no attribute '_default_manager'
Request Method: POST
Request URL: http://localhost:8000/admin/django/user/add/
Django Version: 1.5.2
Exception Type: AttributeError
Exception Value:
type object 'User' has no attribute '_default_manager'
Exception Location: /media/basura/htdocs/modulos/mongoadmin/auth/forms.py in clean_username, line 40
!!!
Hi, following patch fixes an error in Django 1.8.8 where saving any change causes a missing attribute new_objects traceback.
diff --git a/mongodbforms/documents.py b/mongodbforms/documents.py
index 0a432a8..0397c2d 100644
--- a/mongodbforms/documents.py
+++ b/mongodbforms/documents.py
@@ -703,9 +703,16 @@ class BaseDocumentFormSet(BaseFormSet):
Saves model instances for every form, adding and changing instances
as necessary, and returns the list of instances.
"""
+
saved = []
self.new_objects = []
self.changed_objects = []
self.deleted_objects = []
if not form.has_changed() and form not in self.initial_forms:
changed = form.has_changed()
new = form not in self.initial_forms
if not changed and new:
continue
obj = self.save_object(form)
if form.cleaned_data.get("DELETE", False):
self.deleted_objects.append(obj)
elif new:
self.new_objects.append(obj)
elif changed:
self.changed_objects.append(obj)
if commit:
obj.save()
saved.append(obj)
Hi,
We encounter a crash with the following code:
in models
:
class Tag(Document):
name = StringField(verbose_name=_(u'name'), unique=True)
slug = StringField(verbose_name=_(u'slug'))
language = StringField(verbose_name=_(u'language'), default='')
parents = ListField(ReferenceField('self'), default=list)
children = ListField(ReferenceField('self'), default=list)
origin = GenericReferenceField(verbose_name=_(u'Origin'),
help_text=_(u'Initial origin from where '
u'the tag was created from, to eventually '
u'help defining other attributes.'))
duplicate_of = ReferenceField('Tag', verbose_name=_(u'Duplicate of'),
help_text=_(u'Put a "master" tag here to '
u'help avoiding too much different tags '
u'(eg. singular and plurals) with the same '
u'meaning and loss of information.'))
meta = {
'indexes': ['name', ]
}
in admin.py
:
class TagAdmin(admin.DocumentAdmin):
list_display = ('id', 'name', 'language', 'duplicate_of', )
list_display_links = ('id', 'name', )
search_fields = ('name', 'slug', 'duplicate_of', )
change_list_filter_template = "admin/filter_listing.html"
admin.site.register(Tag, TagAdmin)
Stacktrace of the crash. If I change the referencefield of the duplicate_of
attribute to 'self'
instead of 'Tag'
, I get another stacktrace crash, but I think it's basically the same problem.
It doesn't occur if I use ListField(ReferenceField(โฆ [same content]โฆ))
, but obviously I do not want to use a list.
Any hint on this one ?
regards,
Hi,
on our jenkins server, there is no "real" django database at all: we just need the test one created on the fly by ./manage.py test
or ./manage.py jenkins
. Still, the latest version of mongoadmin
crashes:
Traceback (most recent call last):
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv
self.execute(*args, **options.__dict__)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 250, in execute
translation.activate('en-us')
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 90, in activate
return _trans.activate(language)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 183, in activate
_active.value = translation(language)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 172, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 154, in _fetch
app = import_module(appname)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/src/mongoadmin/mongoadmin/__init__.py", line 1, in <module>
from .options import *
File "/var/lib/jenkins/jobs/1flow/workspace/venv/src/mongoadmin/mongoadmin/options.py", line 6, in <module>
from mongoadmin.contenttypes.models import ContentType
File "/var/lib/jenkins/jobs/1flow/workspace/venv/src/mongoadmin/mongoadmin/contenttypes/models.py", line 1, in <module>
from .utils import HAS_RELATIONAL_DB, get_model_or_document
File "/var/lib/jenkins/jobs/1flow/workspace/venv/src/mongoadmin/mongoadmin/contenttypes/utils.py", line 14, in <module>
ContentType.objects.all()[0]
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 215, in __getitem__
return list(qs)[0]
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 92, in __len__
self._result_cache.extend(self._iter)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 301, in iterator
for row in compiler.results_iter():
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 775, in results_iter
for rows in self.execute_sql(MULTI):
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
cursor.execute(sql, params)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 41, in execute
return self.cursor.execute(sql, params)
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 58, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "/var/lib/jenkins/jobs/1flow/workspace/venv/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 54, in execute
return self.cursor.execute(query, args)
DatabaseError: relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
If we git reset --hard HEAD~2
the mongoadmin/
repository, everything is fine again.
So the problem lies in one of your latest 2 patches. I didn't have the time to investigate the "why", but at a glance ContentType.objects.all()[0]
seems to be a little too much assumption that a relational DB exists with Django's own tables (we don't even run syncdb
on the jenkins machine because it will be run for the test database anyway).
regards,
Olivier
MongoEngine trivially supports the following structure, but mongoadmin does not:
class Inner(EmbeddedDocument):
val = StringField()
class Outer(Document):
name = StringField()
inner = EmbeddedDocumentField(Inner)
I'm working on a pull request but I wanted to get this on file in case you have any ideas.
Hello !
When importing "mongoadmin" with Python 3.3.2, there is an error :
No module named 'mongoadmin.contenttypes'
I think you must add "mongoadmin.contenttypes" into packages list of setup.py and it works :)
Regards,
Choko256.
I am trying to integrate it with my mongodb using mongoengine. It is showing me index page but when i try to load a add page it shows me errors that
settings.DATABASES is improperly configured. Please supply the ENGINE value.
and when i try to delete any record i got this error
get_all_related_objects() got an unexpected keyword argument 'include_proxy_eq'
Django: 1.7
MongoEngine: 1.8.7
Configuration like a tutorial, but django droped exception...
Running django 1.3 and latest pull from django-mongoadmin repo. Am I missing something?
here is my admin.py
from mongoadmin import site, DocumentAdmin, InlineDocumentAdmin
from dataportal.models import DataType, Geography, Category
class DataTypeInline(InlineDocumentAdmin):
document = DataType
model = DataType
class GeographyInline(InlineDocumentAdmin):
document = Geography
model = Geography
class DataPortalDocumentAdmin(DocumentAdmin):
inlines = [DataTypeInline, GeographyInline]
site.register(Category, DataPortalDocumentAdmin)
And my models.py
from mongoengine import Document, EmbeddedDocument, EmbeddedDocumentField, StringField, BooleanField, ListField, ReferenceField, IntField, FloatField, ValidationError, queryset_manager, PULL, DENY
class DataType(Document):
name = StringField(max_length=120, required=True, unique=True)
description = StringField()
quarter = BooleanField(default=False)
datatype = ListField(ReferenceField('self', reverse_delete_rule=PULL))
def __unicode__(self):
return self.name
class Geography(Document):
area = StringField(max_length=120)
geography = ListField(StringField(max_length=120))
description = StringField()
def __unicode__(self):
return self.area
class Category(Document):
name = StringField(max_length=120, required=True)
description = StringField()
datatype = ListField(ReferenceField(DataType, reverse_delete_rule=PULL))
geography = ListField(ReferenceField(Geography, reverse_delete_rule=PULL))
def __unicode__(self):
return self.name
I am getting
int() argument must be a string or a number, not 'ObjectId'
What is wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.