On Sun, 2008-04-13 at 06:20 -0700, Leon wrote: > Hi, > I use django admin to manage a table. There is a hyperlink for > each object in the change_list template, which will bring me to the > change_form template. I want to change that hyperlink and redirect it > to another url to handle. I didn't want to customize the current > change_form for this model because it is still used somewhere else. > Anybody knows how to do it?
It's possible, but fairly fiddly. You can create a custom change_list.html template for just that application + model name combination (since the admin interface tries to load a template under admin/<app_name>/<model_name>/change_list.html as one of the options for that page). Then you need to write a template that displays what you would like, which possibly means duplicating a lot of the logic of the original page and the template tags that construct it. With a bit of tracing through the code (admin/templates/admin/change_list.html, admin/tempates/admin/change_list_result.html, admin/templatetags/admin_list.py, admin/views/main.py) it should be quite possible to achieve what you want. Take your time and you'll get there (or use newforms-admin or wait for newforms-admin to be merged into trunk, both of which will be easier). Note that this sort of customisation does require you to read some Python code and templates and do a bit of design work. There isn't a step-by-step guide, so if you aren't up to being able to read the code a bit, this probably isn't the right sort of customisation to be trying to make. Regards, Malcolm -- Tolkien is hobbit-forming. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---