Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 9e64035796cb887391fcc968d74cb1317ab62794 1 parent 85d2b12
Adrian Holovaty authored July 29, 2005

Showing 1 changed file with 8 additions and 7 deletions. Show diff stats Hide diff stats

  1. 15  django/views/admin/main.py
15  django/views/admin/main.py
@@ -48,7 +48,7 @@ def get_query_string(original_params, new_params={}, remove=[]):
48 48
 def index(request):
49 49
     t = template_loader.get_template('index')
50 50
     c = Context(request, {'title': 'Site administration'})
51  
-    return HttpResponse(t.render(c))
  51
+    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
52 52
 
53 53
 def change_list(request, app_label, module_name):
54 54
     from django.core import paginator
@@ -491,7 +491,7 @@ def change_list(request, app_label, module_name):
491 491
         'title': (is_popup and 'Select %s' % opts.verbose_name or 'Select %s to change' % opts.verbose_name),
492 492
         'is_popup': is_popup,
493 493
     })
494  
-    return HttpResponse(t.render(c))
  494
+    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
495 495
 
496 496
 def _get_flattened_data(field, val):
497 497
     """
@@ -777,7 +777,8 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p
777 777
                 return HttpResponseRedirect(post_url_continue % new_object.id)
778 778
             if request.POST.has_key("_popup"):
779 779
                 return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
780  
-                    (getattr(new_object, opts.pk.name), repr(new_object).replace('"', '\\"')))
  780
+                    (getattr(new_object, opts.pk.name), repr(new_object).replace('"', '\\"')),
  781
+                    mimetype='text/html; charset=utf-8')
781 782
             elif request.POST.has_key("_addanother"):
782 783
                 request.user.add_message("%s You may add another %s below." % (msg, opts.verbose_name))
783 784
                 return HttpResponseRedirect(request.path)
@@ -840,7 +841,7 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p
840 841
     raw_template = _get_template(opts, app_label, add=True, show_delete=show_delete, form_url=form_url)
841 842
 #     return HttpResponse(raw_template, mimetype='text/plain')
842 843
     t = template_loader.get_template_from_string(raw_template)
843  
-    return HttpResponse(t.render(c))
  844
+    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
844 845
 
845 846
 def change_stage(request, app_label, module_name, object_id):
846 847
     mod, opts = _get_mod_opts(app_label, module_name)
@@ -956,7 +957,7 @@ def change_stage(request, app_label, module_name, object_id):
956 957
     raw_template = _get_template(opts, app_label, change=True)
957 958
 #     return HttpResponse(raw_template, mimetype='text/plain')
958 959
     t = template_loader.get_template_from_string(raw_template)
959  
-    return HttpResponse(t.render(c))
  960
+    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
960 961
 
961 962
 def _nest_help(obj, depth, val):
962 963
     current = obj
@@ -1072,7 +1073,7 @@ def delete_stage(request, app_label, module_name, object_id):
1072 1073
         "deleted_objects": deleted_objects,
1073 1074
         "perms_lacking": perms_needed,
1074 1075
     })
1075  
-    return HttpResponse(t.render(c))
  1076
+    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
1076 1077
 
1077 1078
 def history(request, app_label, module_name, object_id):
1078 1079
     mod, opts = _get_mod_opts(app_label, module_name)
@@ -1090,4 +1091,4 @@ def history(request, app_label, module_name, object_id):
1090 1091
         'module_name': meta.capfirst(opts.verbose_name_plural),
1091 1092
         'object': obj,
1092 1093
     })
1093  
-    return HttpResponse(t.render(c))
  1094
+    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')

0 notes on commit 9e64035

Please sign in to comment.
Something went wrong with that request. Please try again.