Question

I use django-allauth for account management including signup. The built-in url in allauth app for signup is http://example.com/accounts/signup/. I need to show a Terms & Conditions page before going to signup page. Now, any one can type this URL directly in browser to go to signup page without reading the T&C page. But they should.

How could I do this? Is there any way to add a decorator to that view or any other ways without decorator? The same applies to any admin views.

Était-ce utile?

La solution

You can use django session to store an information if current user has accepted the terms.

If the user hasn't do that, simply redirect him to T&C page.

If you're having difficulties with wrapping third app view function with such checking code, try to implement that logic using middleware process_view method.

The view_func argument and request.session is what you're looking for.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top