mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Changed admin views to output utf-8 charset explicitly
git-svn-id: http://code.djangoproject.com/svn/django/trunk@340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
85d2b12bdf
commit
9e64035796
@ -48,7 +48,7 @@ def get_query_string(original_params, new_params={}, remove=[]):
|
||||
def index(request):
|
||||
t = template_loader.get_template('index')
|
||||
c = Context(request, {'title': 'Site administration'})
|
||||
return HttpResponse(t.render(c))
|
||||
return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
|
||||
|
||||
def change_list(request, app_label, module_name):
|
||||
from django.core import paginator
|
||||
@ -491,7 +491,7 @@ def change_list(request, app_label, module_name):
|
||||
'title': (is_popup and 'Select %s' % opts.verbose_name or 'Select %s to change' % opts.verbose_name),
|
||||
'is_popup': is_popup,
|
||||
})
|
||||
return HttpResponse(t.render(c))
|
||||
return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
|
||||
|
||||
def _get_flattened_data(field, val):
|
||||
"""
|
||||
@ -777,7 +777,8 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p
|
||||
return HttpResponseRedirect(post_url_continue % new_object.id)
|
||||
if request.POST.has_key("_popup"):
|
||||
return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
|
||||
(getattr(new_object, opts.pk.name), repr(new_object).replace('"', '\\"')))
|
||||
(getattr(new_object, opts.pk.name), repr(new_object).replace('"', '\\"')),
|
||||
mimetype='text/html; charset=utf-8')
|
||||
elif request.POST.has_key("_addanother"):
|
||||
request.user.add_message("%s You may add another %s below." % (msg, opts.verbose_name))
|
||||
return HttpResponseRedirect(request.path)
|
||||
@ -840,7 +841,7 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p
|
||||
raw_template = _get_template(opts, app_label, add=True, show_delete=show_delete, form_url=form_url)
|
||||
# return HttpResponse(raw_template, mimetype='text/plain')
|
||||
t = template_loader.get_template_from_string(raw_template)
|
||||
return HttpResponse(t.render(c))
|
||||
return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
|
||||
|
||||
def change_stage(request, app_label, module_name, object_id):
|
||||
mod, opts = _get_mod_opts(app_label, module_name)
|
||||
@ -956,7 +957,7 @@ def change_stage(request, app_label, module_name, object_id):
|
||||
raw_template = _get_template(opts, app_label, change=True)
|
||||
# return HttpResponse(raw_template, mimetype='text/plain')
|
||||
t = template_loader.get_template_from_string(raw_template)
|
||||
return HttpResponse(t.render(c))
|
||||
return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
|
||||
|
||||
def _nest_help(obj, depth, val):
|
||||
current = obj
|
||||
@ -1072,7 +1073,7 @@ def delete_stage(request, app_label, module_name, object_id):
|
||||
"deleted_objects": deleted_objects,
|
||||
"perms_lacking": perms_needed,
|
||||
})
|
||||
return HttpResponse(t.render(c))
|
||||
return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
|
||||
|
||||
def history(request, app_label, module_name, object_id):
|
||||
mod, opts = _get_mod_opts(app_label, module_name)
|
||||
@ -1090,4 +1091,4 @@ def history(request, app_label, module_name, object_id):
|
||||
'module_name': meta.capfirst(opts.verbose_name_plural),
|
||||
'object': obj,
|
||||
})
|
||||
return HttpResponse(t.render(c))
|
||||
return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user