Q:

Raising a validationerror in django with marksafe

I have this piece of code in my django project that raises a ValidationError in one of my forms
 raise forms.ValidationError(mark_safe(_("You don't have enough funds, please click -><a href='%(url)s'> here </a><- go to your account to add funds.")),
                                            code='insufficent_funds',
                                            params={'url':reverse('add_funds')}) 

Unfortunately when I use mark safe it seems that the params are not processed(not the right word?) so the html looks like this on my webpage 
You don't have enough funds, please click -><a href="http://127.0.0.1:8000/edit/%(url)s"> here </a><- go to your account to add funds.

Any way to get around this?

A:

There should be a better way but one way to get around this is
text = "You don't have enough funds, please click -><a href='%s'> here </a><- go to your account to add funds." % reverse('add_funds')

raise forms.ValidationError(mark_safe(_(text)),
                                            code='insufficent_funds',
                                            )

