Right you are Daniel, works like a charm, thank you!
/L

Daniel Roseman wrote:
> On Nov 25, 4:50 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> I'm trying to influence one of the admin interface change list
>> fields by using the below get_progress() method in list_display,
>> and using mark_safe().
>>
>> However, I can't get this to work:
>>
>> class Job(models.Model):
>>      progress = models.PositiveSmallIntegerField()
>>
>>      def get_progress(self):
>>          snippet = u"<p>Progress is %d</p>" % self.progress
>>          return mark_safe(snippet)
>>
>> What happens is that the "<p>" and "</p>" gets translated into
>> "&lt;p&gt;" and "&lt;/p&gt;" in the output. I thought mark_safe()
>> would help me to avoid that. Obviously not right.
>>
>> Is there another way to tell django not to escape the output?
>>
>> Any ideas appreciated
>> /Lars
> 
> To get HTML into the change_list view, you need to use allow_tags:
> 
>      def get_progress(self):
>          snippet = u"<p>Progress is %d</p>" % self.progress
>          return mark_safe(snippet)
>     get_progress.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 django-users@googlegroups.com
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