I installed the xadmin app to django now how do i call it or implement it for my admin module.what changes have to made in the setting.py and admin.py file
You should add xadmin application into the settings:
INSTALLED_APPS = (
...
'xadmin',
...
)
Also you need to enable xadmin as you do for django's admin in the urls.py:
# urls.py
...
import xadmin
xadmin.autodiscover()
...
urlpatterns = patterns('',
...
And important notice: your file with models registration should be named adminx.py, not admin.py. Django's admin is little bit incompatible with xadmin (because xadmin has alot of custom implementation and metaclasses). But for the common case it's done by the same way (except base class is object, because xadmin automatically extends it by plugins), i.e.:
# adminx.py
import xadmin
from . import models
class ProductAdmin(object):
list_display = ['name', 'address', 'position']
class ReviewAdmin(object):
list_display = ['created', 'owner', 'text']
xadmin.site.register(models.ProductInfo, ProductAdmin)
xadmin.site.register(models.Review, ReviewAdmin)
I've made very tricky hack for automatic merging base django admin's descriptions into the xadmin registry. If you are interested in I could share it.
Updated: my gist with such merger
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With