Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render_to_response is deprecated in higher Django versions from 1.9 onwards #225

Open
ghost opened this issue May 16, 2018 · 1 comment
Open

Comments

@ghost
Copy link

ghost commented May 16, 2018

I had the issue with template context_processor, when i tried to upgrade the system from 1.5 to 1.10.7.

there was Keyerror 'request' in context

I fixed it by using render instead of using render_to_response in views.py like this

def form_sent(request, slug, template="forms/form_sent.html"):
    """
    Show the response message.
    """
    published = Form.objects.published(for_user=request.user)
    context = {"form": get_object_or_404(published, slug=slug)}
    return render(request, template, context) # replaced

May be you can update this for higher django version.

cheers!!!!

@stephenmcd
Copy link
Owner

Could you create a pull request with the fix? Thanks

krushiraj added a commit to krushiraj/django-forms-builder that referenced this issue Jul 7, 2018
Keyerror 'request' in context was fixed. Used render_to_response and also render methods to generate response, which can work for almost all features of Django.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant