diff --git a/django/views/admin/main.py b/django/views/admin/main.py index ec282301d3..4b812a802c 100644 --- a/django/views/admin/main.py +++ b/django/views/admin/main.py @@ -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('' % \ - (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')