My use case looks very simple, but I did not find anything on the Internet!
An idea is a form with a flag βI have read and agree to the termsβ and a link to βtermsβ that points to a page with such terms and conditions ... Classic!
So, I have a field in my form as follows:
tos = forms.BooleanField(widget=forms.CheckboxInput(), label=_(u'I have read and agree to the <a href="%s" target="_blank">terms and conditions</a>' % reverse('terms_of_use')), initial=False)
where "terms of use" is the name of one of my url patterns in urls.py
But I get an error message:
ImproperlyConfigured: The included urlconf urls doesn't have any patterns in it
My urlconf works fine on the whole site, so I assumed that the problem is that urlconf is not populated yet when the form is displayed?
I tried using lazy_reverse = lazy (reverse, str) instead of the opposite, but does not solve anything.
Is there any way to make this work? The use case seems very simple, so of course there is a way to do this without breaking the form inside my template ?!
source share