Changed render_to_response() to render() - this should work for django1.9.4 plus django1.10

Without this change, django1.10 is missing the 'user' object from the context, which results in
a very hard to track down bug manifesting in ;
"NoReverseMatch: Reverse for 'helpdesk_rss_user' with arguments '('',)' and keyword arguments '{}' not found."
At first glance users may think this is the dots-in-usernames bug, but the username is totally missing.
This commit is contained in:
Daryl
2016-06-21 17:18:06 +12:00
parent 7dd4aa11d7
commit 558f140bfb
4 changed files with 85 additions and 87 deletions

View File

@ -19,7 +19,7 @@ try:
except ImportError:
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.shortcuts import render
from django.template import loader, Context
import simplejson
from django.views.decorators.csrf import csrf_exempt
@ -64,7 +64,7 @@ def api(request, method):
warnings.warn("django-helpdesk API will be removed in January 2016. See https://github.com/rossp/django-helpdesk/issues/198 for details.", category=DeprecationWarning)
if method == 'help':
return render_to_response('helpdesk/help_api.html')
return render(request, template_name='helpdesk/help_api.html')
if request.method != 'POST':
return api_return(STATUS_ERROR_BADMETHOD)