GithubHelp home page GithubHelp logo

m-vdb / django-mongoadmin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from work4labs/django-mongoadmin

0.0 2.0 0.0 265 KB

Integrates mongodb into django's admin

Home Page: http://www.schafproductions.com/projects/mongo-admin/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

django-mongoadmin's Introduction

django mongoadmin

This a drop in replacement for the django admin that works with monodb. It uses the django admin stuff wherever possible and can be used together with normal django models and a SQL database.

Note: The master branch requires Django 1.6. For older Django versions you can use the pre-django-1.6 branch.

Requirements

Usage

Add mongoadmin to INSTALLED_APPS settings

INSTALLED_APPS = (
	...
   	'mongoadmin',
   	'django.contrib.admin',
	...
)

Add mongoadmin to urls.py

from django.contrib import admin
admin.autodiscover()

from mongoadmin import site

urlpatterns = patterns('',
   	# Uncomment the next line to enable the admin:
   	url(r'^admin/', include(site.urls)),
)

The admin.py for your app needs to use mongoadmin instead of django's admin:

from mongoadmin import site, DocumentAdmin

from app.models import AppDocument
	
class AppDocumentAdmin(DocumentAdmin):
    pass
site.register(AppDocument, AppDocumentAdmin)

Now the document should appear as usual in django's admin.

Using third party apps with mongoadmin

To use third party apps (i.e. apps that register their admin classes in django.contrib.admin.site) with mongoadmin you have to add MONGOADMIN_OVERRIDE_ADMIN = True to your settings file. This overrides the django admin site with mongoadmin's admin site.

What works and doesn't work

django-mongoadmin currently only supports the most basic things and even they are not really tested.

You probably won't be able to use all of the nice stuff Django provides for relations. The problem is that Django bi-directional relations with a lot of magic, while mongoengine has a uni-directional ReferenceField. So in order to make relations really work one would either have to inject so much code into the documents and querysets that they become clones of Django's stuff or rewrite huge parts of the admin. If you feel that either approach is worth it, go for it and submit a pull request. Otherwise feel free to submit an issue but don't get your hopes up for a fix.

django-mongoadmin's People

Contributors

jschrewe avatar kostanos avatar liluo avatar maikelwever avatar olivierlefloch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.