Skip to content
A basic CRUD admin interface for Django+MongoEngine, very similar to `django.contrib.admin`
Python
Pull request Compare This branch is 2 commits ahead of dmpayton:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
mongoadmin
.gitignore
LICENSE
README.mkd
setup.py

README.mkd

MongoAdmin

A basic CRUD admin interface for Django+MongoEngine, very similar to django.contrib.admin.


THIS APP HAS BEEN DEPRECATED. PLEASE SEE THE POST ON MONGOENGINE-USERS FOR MORE INFORMATION:

http://groups.google.com/group/mongoengine-users/browse_thread/thread/8c2d52ab02b3c239


Requirements:

Todo:

  • Changelist pagination
  • mongoengine.django.auth.User password form
  • Better documentation
  • ... Probably lots more

Caution:

I have not yet verified that this works with complicated field types, such as ListField, DictField, EmbeddedDocumentField, etc. I have a feeling these might not work, but who knows?

Example:

urls.py

import mongoadmin
from django.conf.urls.defaults import *

mongoadmin.autodiscover('admin')

urlpatterns += patterns('',
    ## ... your URLs here
    url(r'^mongo-admin/', include(mongoadmin.site.urls, namespace='mongoadmin')),
)

yourapp/admin.py

import mongoadmin
from mongoengine.django.auth import User

class UserAdmin(mongoadmin.MongoAdmin):
    group = 'Accounts'
    list_items = ('username', 'email', 'is_active', 'is_staff')

    def get_form(self, *args, **kwargs):
        form = super(UserAdmin, self).get_form(*args, **kwargs)
        form.fields['username'].required = True
        form.fields['email'].required = True
        return form

# mongoadmin.site.register(User) # With or without the admin
mongoadmin.site.register(User, UserAdmin)

Documentation

mongoadmin.MongoAdmin

MongoAdmin.form

Similar to ModelAdmin.form, but a mongoform. Must inherit mongoadmin.MongoAdminForm.

Default: mongoadmin.MongoAdminForm


MongoAdmin.group

Used to visually categorize documents on the admin index.

Default: "Documents"


MongoAdmin.list_items

Similar to ModelAdmin.list_display. Each item may be an attribute or method on mongoengine.Document or mongoadmin.MongoAdmin.

Default: ['__unicode__']


mongoadmin.verbose_name

Similar to Model._meta.verbose_name.

Default: ModelAdmin.model._class_name


mongoadmin.verbose_name_plural

Similar to Model._meta.verbose_name_plural.

Default: MongoAdmin.verbose_name + 's'


Something went wrong with that request. Please try again.