Thank you Michael,

Can you explain me the "Clean" way to do that ?

On May 8, 2:45 pm, Michael <[email protected]> wrote:
> On Fri, May 8, 2009 at 3:26 PM, Tom <[email protected]> wrote:
>
> > My model :
>
> > url = models.URLField(max_length=500,blank=True,verify_exists=False)
>
> > and I want the column url display url as a link (<a href=""></a>)
>
> > Any ideas ?
>
> > Thanks for your help.
>
> In general the models are for your database logic and display logic like
> this would be saved until your template. But since you insist, one easy way
> to accomplish this is by setting up a property on your model like so:
>
> @property
> def url_formatted(self):
>      return '<a href="%s"></a>' % self.url
>
> then you have a property on your model named url_formatted that will give
> you the output you desire.
>
> I hope that helps,
>
> Michael
--~--~---------~--~----~------------~-------~--~----~
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