Hi there,
I would like to mix the admin forms with custom views that fall back
on the admin change_form for editing only. What's the cleanest way of
tackling that?
As a starting point, I've created a custom instance of AdminSite and
reroute the url that is normally used for editing an entry to a custom
view. So here is a snippet from my urls.py:
urlpatterns = patterns( 'brickit.registry.views',
# new view, the change_list now sends you to this view
(r'^registry/registry/biobrick/(?P<id>[0-9]+)/$', 'biobrick'),
# rescue admin edit form
(r'^registry/(.*)/edit/$', customadmin.site.root ),
# modified admin interface
(r'^registry/(.*)', customadmin.site.root),
)
The 'biobrick' page contains a link to <a href="./edit">Edit</a>
which indeed opens the old Edit form. There are some problems though:
- javascript stops working in the form
- the "bread crumbs" links at the top are pointing to the wrong
location
Besides, since I only have a single site, it would be nice to remove
the site level from the URL (e.g. registry/biobrick/1 rather than
registry/registry/biobrick/1).
Probably, one could somehow repair the javascript issue by also
overloading the change_form for this particular model but I am
wondering if the whole architecture isn't rather messy. Rather than
hacking myself into the admin architecture, should I approach the
problem the other way round? Is there a way to selectively link
certain admin forms into a custom public view?
Hopefully this question makes any sense. My web development and django
knowledge is very very limited. Any hints are welcome!
Thanks!
Raik
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---