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.

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top