mirror of https://github.com/django/django.git
Converted load_and_render() calls to render_to_response() because of [664].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@665 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
62f036d67d
commit
a7efb3939f
|
@ -1,7 +1,7 @@
|
|||
from django.core import formfields, validators
|
||||
from django.core.mail import mail_admins, mail_managers
|
||||
from django.core.exceptions import Http404, ObjectDoesNotExist
|
||||
from django.core.extensions import DjangoContext, load_and_render
|
||||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.models.auth import users
|
||||
from django.models.comments import comments, freecomments
|
||||
from django.models.core import contenttypes
|
||||
|
@ -227,7 +227,7 @@ def post_comment(request):
|
|||
return field_list
|
||||
comment = errors and '' or manipulator.get_comment(new_data)
|
||||
comment_form = CommentFormWrapper(manipulator, new_data, errors, rating_choices)
|
||||
return load_and_render('comments/preview', {
|
||||
return render_to_response('comments/preview', {
|
||||
'comment': comment,
|
||||
'comment_form': comment_form,
|
||||
'options': options,
|
||||
|
@ -295,7 +295,7 @@ def post_free_comment(request):
|
|||
errors = manipulator.get_validation_errors(new_data)
|
||||
if errors or request.POST.has_key('preview'):
|
||||
comment = errors and '' or manipulator.get_comment(new_data)
|
||||
return load_and_render('comments/free_preview', {
|
||||
return render_to_response('comments/free_preview', {
|
||||
'comment': comment,
|
||||
'comment_form': formfields.FormWrapper(manipulator, new_data, errors),
|
||||
'options': options,
|
||||
|
@ -332,4 +332,4 @@ def comment_was_posted(request):
|
|||
obj = content_type.get_object_for_this_type(pk=object_id)
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
return load_and_render('comments/posted', {'object': obj}, context_instance=DjangoContext(request))
|
||||
return render_to_response('comments/posted', {'object': obj}, context_instance=DjangoContext(request))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.core.exceptions import Http404
|
||||
from django.core.extensions import DjangoContext, load_and_render
|
||||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.models.comments import comments, karma
|
||||
|
||||
def vote(request, comment_id, vote):
|
||||
|
@ -25,4 +25,4 @@ def vote(request, comment_id, vote):
|
|||
karma.vote(request.user.id, comment_id, rating)
|
||||
# Reload comment to ensure we have up to date karma count
|
||||
comment = comments.get_object(pk=comment_id)
|
||||
return load_and_render('comments/karma_vote_accepted', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
return render_to_response('comments/karma_vote_accepted', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from django.core.extensions import DjangoContext, load_and_render
|
||||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.core.exceptions import Http404
|
||||
from django.models.comments import comments, moderatordeletions, userflags
|
||||
from django.views.decorators.auth import login_required
|
||||
|
@ -21,7 +21,7 @@ def flag(request, comment_id):
|
|||
if request.POST:
|
||||
userflags.flag(comment, request.user)
|
||||
return HttpResponseRedirect('%sdone/' % request.path)
|
||||
return load_and_render('comments/flag_verify', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
return render_to_response('comments/flag_verify', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
flag = login_required(flag)
|
||||
|
||||
def flag_done(request, comment_id):
|
||||
|
@ -29,7 +29,7 @@ def flag_done(request, comment_id):
|
|||
comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID)
|
||||
except comments.CommentDoesNotExist:
|
||||
raise Http404
|
||||
return load_and_render('comments/flag_done', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
return render_to_response('comments/flag_done', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
|
||||
def delete(request, comment_id):
|
||||
"""
|
||||
|
@ -54,7 +54,7 @@ def delete(request, comment_id):
|
|||
m = moderatordeletions.ModeratorDeletion(None, request.user.id, comment.id, None)
|
||||
m.save()
|
||||
return HttpResponseRedirect('%sdone/' % request.path)
|
||||
return load_and_render('comments/delete_verify', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
return render_to_response('comments/delete_verify', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
delete = login_required(delete)
|
||||
|
||||
def delete_done(request, comment_id):
|
||||
|
@ -62,4 +62,4 @@ def delete_done(request, comment_id):
|
|||
comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID)
|
||||
except comments.CommentDoesNotExist:
|
||||
raise Http404
|
||||
return load_and_render('comments/delete_done', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
return render_to_response('comments/delete_done', {'comment': comment}, context_instance=DjangoContext(request))
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.core import meta
|
|||
from django import templatetags
|
||||
from django.conf import settings
|
||||
from django.models.core import sites
|
||||
from django.core.extensions import DjangoContext, load_and_render
|
||||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.core.exceptions import Http404, ViewDoesNotExist
|
||||
from django.core import template, template_loader, defaulttags, defaultfilters, urlresolvers
|
||||
try:
|
||||
|
@ -17,10 +17,10 @@ MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_')
|
|||
def doc_index(request):
|
||||
if not doc:
|
||||
return missing_docutils_page(request)
|
||||
return load_and_render('doc/index', context_instance=DjangoContext(request))
|
||||
return render_to_response('doc/index', context_instance=DjangoContext(request))
|
||||
|
||||
def bookmarklets(request):
|
||||
return load_and_render('doc/bookmarklets', {
|
||||
return render_to_response('doc/bookmarklets', {
|
||||
'admin_url' : "%s://%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', request.META['HTTP_HOST']),
|
||||
}, context_instance=DjangoContext(request))
|
||||
|
||||
|
@ -59,7 +59,7 @@ def template_tag_index(request):
|
|||
# Fix registered_tags
|
||||
template.registered_tags, template.registered_filters = saved_tagset
|
||||
|
||||
return load_and_render('doc/template_tag_index', {'tags': tags}, context_instance=DjangoContext(request))
|
||||
return render_to_response('doc/template_tag_index', {'tags': tags}, context_instance=DjangoContext(request))
|
||||
|
||||
def template_filter_index(request):
|
||||
if not doc:
|
||||
|
@ -91,7 +91,7 @@ def template_filter_index(request):
|
|||
|
||||
template.registered_tags, template.registered_filters = saved_tagset
|
||||
|
||||
return load_and_render('doc/template_filter_index', {'filters': filters}, context_instance=DjangoContext(request))
|
||||
return render_to_response('doc/template_filter_index', {'filters': filters}, context_instance=DjangoContext(request))
|
||||
|
||||
def view_index(request):
|
||||
if not doc:
|
||||
|
@ -110,7 +110,7 @@ def view_index(request):
|
|||
'site' : sites.get_object(pk=settings_mod.SITE_ID),
|
||||
'url' : simplify_regex(regex),
|
||||
})
|
||||
return load_and_render('doc/view_index', {'views': views}, context_instance=DjangoContext(request))
|
||||
return render_to_response('doc/view_index', {'views': views}, context_instance=DjangoContext(request))
|
||||
|
||||
def view_detail(request, view):
|
||||
if not doc:
|
||||
|
@ -128,7 +128,7 @@ def view_detail(request, view):
|
|||
body = doc.parse_rst(body, 'view', 'view:' + view)
|
||||
for key in metadata:
|
||||
metadata[key] = doc.parse_rst(metadata[key], 'model', 'view:' + view)
|
||||
return load_and_render('doc/view_detail', {
|
||||
return render_to_response('doc/view_detail', {
|
||||
'name': view,
|
||||
'summary': title,
|
||||
'body': body,
|
||||
|
@ -148,7 +148,7 @@ def model_index(request):
|
|||
'module' : opts.app_label,
|
||||
'class' : opts.module_name,
|
||||
})
|
||||
return load_and_render('doc/model_index', {'models': models}, context_instance=DjangoContext(request))
|
||||
return render_to_response('doc/model_index', {'models': models}, context_instance=DjangoContext(request))
|
||||
|
||||
def model_detail(request, model):
|
||||
if not doc:
|
||||
|
@ -185,7 +185,7 @@ def model_detail(request, model):
|
|||
'data_type' : get_return_data_type(func_name),
|
||||
'verbose' : verbose,
|
||||
})
|
||||
return load_and_render('doc/model_detail', {
|
||||
return render_to_response('doc/model_detail', {
|
||||
'name': '%s.%s' % (opts.app_label, opts.module_name),
|
||||
'summary': "Fields on %s objects" % opts.verbose_name,
|
||||
'fields': fields,
|
||||
|
@ -205,7 +205,7 @@ def template_detail(request, template):
|
|||
'site' : sites.get_object(pk=settings_mod.SITE_ID),
|
||||
'order' : list(settings_mod.TEMPLATE_DIRS).index(dir),
|
||||
})
|
||||
return load_and_render('doc/template_detail', {
|
||||
return render_to_response('doc/template_detail', {
|
||||
'name': template,
|
||||
'templates': templates,
|
||||
}, context_instance=DjangoContext(request))
|
||||
|
@ -216,7 +216,7 @@ def template_detail(request, template):
|
|||
|
||||
def missing_docutils_page(request):
|
||||
"""Display an error message for people without docutils"""
|
||||
return load_and_render('doc/missing_docutils')
|
||||
return render_to_response('doc/missing_docutils')
|
||||
|
||||
def load_all_installed_template_libraries():
|
||||
# Clear out and reload default tags
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.parts.auth.formfields import AuthenticationForm
|
||||
from django.core import formfields, template_loader
|
||||
from django.core.extensions import DjangoContext, load_and_render
|
||||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.models.auth import users
|
||||
from django.models.core import sites
|
||||
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
|
||||
|
@ -22,7 +22,7 @@ def login(request):
|
|||
else:
|
||||
errors = {}
|
||||
request.session.set_test_cookie()
|
||||
return load_and_render('registration/login', {
|
||||
return render_to_response('registration/login', {
|
||||
'form': formfields.FormWrapper(manipulator, request.POST, errors),
|
||||
REDIRECT_FIELD_NAME: redirect_to,
|
||||
'site_name': sites.get_current().name,
|
||||
|
@ -33,7 +33,7 @@ def logout(request, next_page=None):
|
|||
try:
|
||||
del request.session[users.SESSION_KEY]
|
||||
except KeyError:
|
||||
return load_and_render('registration/logged_out', context_instance=DjangoContext(request))
|
||||
return render_to_response('registration/logged_out', context_instance=DjangoContext(request))
|
||||
else:
|
||||
# Redirect to this page until the session has been cleared.
|
||||
return HttpResponseRedirect(next_page or request.path)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.core import formfields, template_loader, validators
|
||||
from django.core.extensions import DjangoContext, load_and_render
|
||||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.models.auth import users
|
||||
from django.views.decorators.auth import login_required
|
||||
from django.utils.httpwrappers import HttpResponseRedirect
|
||||
|
@ -76,11 +76,11 @@ def password_reset(request, is_admin_site=False):
|
|||
else:
|
||||
form.save()
|
||||
return HttpResponseRedirect('%sdone/' % request.path)
|
||||
return load_and_render('registration/password_reset_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
||||
return render_to_response('registration/password_reset_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
||||
context_instance=DjangoContext(request))
|
||||
|
||||
def password_reset_done(request):
|
||||
return load_and_render('registration/password_reset_done', context_instance=DjangoContext(request))
|
||||
return render_to_response('registration/password_reset_done', context_instance=DjangoContext(request))
|
||||
|
||||
def password_change(request):
|
||||
new_data, errors = {}, {}
|
||||
|
@ -91,9 +91,9 @@ def password_change(request):
|
|||
if not errors:
|
||||
form.save(new_data)
|
||||
return HttpResponseRedirect('%sdone/' % request.path)
|
||||
return load_and_render('registration/password_change_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
||||
return render_to_response('registration/password_change_form', {'form': formfields.FormWrapper(form, new_data, errors)},
|
||||
context_instance=DjangoContext(request))
|
||||
password_change = login_required(password_change)
|
||||
|
||||
def password_change_done(request):
|
||||
return load_and_render('registration/password_change_done', context_instance=DjangoContext(request))
|
||||
return render_to_response('registration/password_change_done', context_instance=DjangoContext(request))
|
||||
|
|
Loading…
Reference in New Issue