The "safe" filter works on a string, not the entire form. So you'll
have to apply it to the label of the field:

{{ form.tos.label|safe }}

Hope that helps.



On Dec 4, 11:55 am, Viktor <viktor.n...@gmail.com> wrote:
> ahoj,
>
> I wrote a simple backend that extends RegistrationFormTermsOfService
> of django-restration as I would like to add links into the text
> stating that the user accepts the terms of service.
>
> But when I pass it to the template, the link's text is always escaped.
> I've tried to add a template filter, but it didn't help.
>
> here is the code
>
> class RegistrationFormTermsOfService(RegistrationForm):
>     tos = forms.BooleanField(widget=forms.CheckboxInput
> (attrs=attrs_dict),
>                              label=_(u'I have read and agree to the <a
> href="%s">Terms of Service</a>') % settings.TERMS_OF_SERVICE_URL,
>                              error_messages={ 'required': _("You must
> agree to the terms to register") })
>
> and I've tried to write this out with:
> {{ form|safe }}
>
> but I still ended up with:
> I have read and agree to the <a href="/tos/">Terms of Service</a>:
>
> could someone give me an idea how to solve this problem?
>
> thx, Viktor

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.


Reply via email to