forked from jschrewe/django-mongoadmin
-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.txt
80 lines (57 loc) · 2.26 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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.
Requirements
------------
- Django >= 1.3
- `mongoengine <http://mongoengine.org/>`__ >= 0.6
- `django-mongodbforms <https://github.com/jschrewe/django-mongodbforms>`__
Usage
-----
Add mongoadmin to ``INSTALLED_APPS`` settings
.. code:: python
INSTALLED_APPS = (
...
'mongoadmin',
'django.contrib.admin',
...
)
Add mongoadmin to ``urls.py``
.. code:: python
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:
.. code:: python
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.