Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion How to overwrite the hyperlink of objects in change list template of django admin?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Malcolm Tredinnick  
View profile  
 More options Apr 14 2008, 11:23 am
From: Malcolm Tredinnick <malc...@pointy-stick.com>
Date: Mon, 14 Apr 2008 11:23:09 +1000
Local: Mon, Apr 14 2008 11:23 am
Subject: Re: How to overwrite the hyperlink of objects in change list template of django admin?

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/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google