reusing contrib.admin functionality

7 views
Skip to first unread message

mdor...@gmail.com

unread,
Jun 3, 2006, 5:24:10 PM6/3/06
to Django users
I have several places in my application where I like to implement
search/filter capabilities like the admin interface provides. Is there
an API for using the admin-code, or is is just "rip out what you need"?

I'm aware http://code.djangoproject.com/wiki/NewAdminChanges but that
didn't help me understanding how to use the ChangeList functionality.

Any hints?

oggie rob

unread,
Jun 3, 2006, 8:48:10 PM6/3/06
to Django users
> Is there an API for using the admin-code, or is is just "rip out what you need"?

It is still an "all or nothing" application (i.e. no API). If you use
admin, it will be applied to whatever you want to have visible from the
urls.py file, so this does give you a lot of flexbility.

e.g. if you want to only allow the admin list view for MyObject but
nothing else in your app, follow the directions for adding admin
functionality, but in your urls.py file, instead of:
(r'^/{0,1}', include('django.contrib.admin.urls.admin'))

add:
(r'^objectlist/$', 'django.contrib.admin.views.main.change_list',
{'app_label':'myapp','module_name':'myobject'})
or:
(r'^app_label/myobject/$',
'django.contrib.admin.views.main.change_list')

and whatever else you want from django/contrib/admin/urls.py
You will have to work around the expected relative urls from the admin
pages a little.

-rob

Reply all
Reply to author
Forward
0 new messages