idlesign/django-sitegate

Example views fail in Django 1.5+

douglasgoodwin opened this issue · 5 comments

This approach is used throughout the documentation.

from django.shortcuts import render
from sitegate.decorators import sitegate_view

@sitegate_view  
def entrance(request):
    return render(request, 'entrance.html', {'title': 'Sign in & Sign up'})

But the request variables don't flow to the templatetag context. Fail!

This works:

@signup_view(flow=ModernSignup)
def register(request):
    return render(RequestContext(request), 'enter.html', {'title': 'Sign up'})

summary:

request -> RequestContext(request)

Can't reproduce. Please dump your request from 'enter.html' and put it somewhere, where I could see it %)
Bear in mind render shortcut already forces RequestContext internally.

Getting the same problem on Django 1.5.1 and Python 2.7.2.

@douglasgoodwin's doesn't work as well because RequestContext has no attribute META.

Using any of the view decorators provided by sitegate will result %view%_form tag is used but the appropriate form is not found in context.

Example: the quick example provided in the documentation.

@beshrkayali Aha, Py2.7, no form in a context — that's something. Thank you, I'll check it.

Seems that an important step has escaped from the docs: Make sure TEMPLATE_CONTEXT_PROCESSORS in your settings file has django.core.context_processors.request.

Check that out.

I shall consider it closed, feel free to reopen as required.