In your template, you can use the "urlize" templatetag: {{ mymodel.url|urlize }}
On May 11, 3:29 pm, Tom <thomas.dr...@gmail.com> wrote: > Thank you Michael, > > Can you explain me the "Clean" way to do that ? > > On May 8, 2:45 pm, Michael <newmani...@gmail.com> wrote: > > > On Fri, May 8, 2009 at 3:26 PM, Tom <thomas.dr...@gmail.com> 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 django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---