Xadmin Quickstart Guide¶
For using Xadmin, Django 1.4 needs to be installed and an Admin Site has to be activated.
Installation¶
Using pip
:
pip install django-xadmin
Installing from source
Download the latest source tarball from https://github.com/sshwsfc/django-xadmin or git clone
the repository. Then execute the following in the project directory:
pip install -r requirements.txt
Note
Before running you can choose to edit the file requirements.txt
. Note that xlwt
is not required; you can delete this entry if you do not need to export Excel workbooks.
Running the demo¶
If you have downloaded the source tarball of Xadmin, you will be able to locate a demo_app
directory in the project hierarchy. The commands below can be issued to quickly create a demo instance of Xadmin:
cd demo_app
python manage.py runserver
Point your browser to http://127.0.0.1:8000
to see the results.
Working with existing projects¶
Being a Django application, Xadmin can be easily plugged into Django-powered sites.
First, edit your settings.py
to add Xadmin to your INSTALLED_APPS
. (Note that the vanilla Django admin app’s dependencies also have to be installed, but Django admin itself need not):
INSTALLED_APPS = (
...
'xadmin',
'crispy_forms',
'reversion',
...
)
Then add URL patterns and do autodiscover
:
# -*- coding: utf-8 -*-
import xadmin
xadmin.autodiscover()
# version模块自动注册需要版本控制的 Model
from xadmin.plugins import xversion
xversion.register_models()
urlpatterns = patterns('',
url(r'xadmin/', include(xadmin.site.urls)),
)
Collect media:
python manage.py collectstatic