you just need to add one function
in your models.py
def somename(self):
return "<a href='http://www.somesite.com/admin/?q=%s' >click
here</a>"%(self.id) <http://www.somesite.com/admin/?q=1090>
somename.allow_tags = True
somename.short_description = "My field"
in you admin.py
list_display=['somename',]
i think this would help you to display extra fields with what you want.In
this allow_html_tags =true will load the html tags
<http://www.somesite.com/admin/?q=1090>
On Thu, Jul 8, 2010 at 2:05 PM, 玉东 <[email protected]> wrote:
> Hi all,
>
> Now I am trying to do a simple admin customization:
>
> I have a model called 'host', and I have a corresponding admin class
> called hostAdmin and got registered.
>
> I put some fields of the 'host' model into the list_display of
> hostAdmin so that we can get it shown in the
>
> admin site. And it is an easy and common way to get fields shown.
>
> The question is that I want to show a little more: an extra column
> with links in each row. Each link is related
>
> to one field of the model. For example, the 'host' model has a field
> called 'id' and one value of it is '1090'
>
> so I hope the link would be http://www.somesite.com/admin/?q=1090.
>
> Should I extend some admin templates to do this? Or what should I do?
>
> Any help is appreciated :)
>
>
> --
> 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]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
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.