Putting links into text in Django
- by Dane Larsen
I have a notifications app that generates notifications for users. The notification class has to be really general, because notifications are generated by all sorts of different things.
My question is this: How do I insert links into the text of the notifications?
What I tried was this:
note = Notification(..., notification="""%s %s has accepted the task: <a href="/tasks/%d/">%s</a>.""" % (request.user.first_name, request.user.last_name, task.id, task.name), ...)
In retrospect, it's obvious this wouldn't work.
How should I go about this?
Thanks in advance!