In a model, I have added a method that builds text for a html link
(based on model attributes) similar to:
---------------------------------
from django.db import models
class Destination(models.Model)
name = models.CharField(max_length=25)
location_nbr = models.CharField(max_length=4)
def link_to_other_site(self):
return "<a href='http://www.anothersite.com?location_nbr=%s'
target='_new'>link</a>" % (self.location_nbr)
--------------------------------
I hope to display a working link (for reference, not for any django
based use) in the admin list for this model by writing:
--------------------------------
from django.contrib import admin
admin.autodiscover()
class Destination_admin(admin.ModelAdmin):
list_display = ('name', location_nrd, link_to_other_site)
admin.site.register(Destination, Destination_admin)
---------------------------------
most of you probably know this will not give the desired result - it
shows the correct test, but not as a hyperlink.
Would you please enlighten a very humble newbee?
Also, can it e included in a fieldset of an admin change page?
--
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.