Frank Singleton wrote:
> Hi,
>
> Is it possible to embed hyperlinks in the list_display list for model
ok read this in the docs..
If the string given is a method of the model, Django will HTML-escape
the output by default.
If youd rather not escape the output of the method, give the method an
allow_tags attribute whose value is True.
eg:
class Person(models.Model):
first_name = models.CharField(maxlength=50)
last_name = models.CharField(maxlength=50)
color_code = models.CharField(maxlength=6)
class Admin:
list_display = ('first_name', 'last_name', 'colored_name')
def colored_name(self):
return '<span style="color: #%s;">%s %s</span>' % (self.color_code,
self.first_name, self.last_name)
colored_name.allow_tags = True
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---