On Sun, Sep 6, 2009 at 6:21 AM, Joshua Partogi <joshua.part...@gmail.com>wrote:

>
> On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman <dan...@roseman.org.uk>wrote:
>
>> Define a custom method on the FooAdmin class which returns the HTML of
>> a link to the Bar changelist with the relevant filter applied:
>>
>>    def bar_link(self, obj):
>>        return '<a href="/admin/myapp/bar/?foo=%s">See Bars</a>' %
>> obj.pk
>>    bar_link.allow_tags = True
>>
>> See
>> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display
>>
>
> Is there any built-in method in django where we can that url without having
> to hardcode it?
>
>
Yes (assuming you are using 1.1), for the base changelist url:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls

You'll still have to add on the filter value yourself.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to