On Jul 24, 8:27 am, StevenC <[email protected]> wrote:
> Hey,
>
> Im new to Django and have create an online application system.
>
> I need to know is it possible to customise the List Display and have a
> customn link next to EVERY entry which points to a nother URL with its
> ID within.
>
> For example,
>
> If i have a student application. Their ID being 1. I need a link next
> to it which points to ../application/1/
>
> Does anyone have any ideas?
>
> Cheers


Sure. Just create a custom method on your ModelAdmin subclass which
returns the HTML of the link you want.

    class MyAdmin(admin.ModelAdmin):
        list_display = ('name', 'my_link')
        class Meta:
             model = MyModel

        def my_link(self, obj):
            return '<a href="/link/to/%s/">My Link<a>' % obj.id
        my_link.allow_tags = True

--
DR.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to