Ticket #170: main.py.patch

File main.py.patch, 2.9 KB (added by Adrian Holovaty, 19 years ago)

Experimental patch to django.views.admin.main

  • main.py

     
    4848def index(request):
    4949    t = template_loader.get_template('index')
    5050    c = Context(request, {'title': 'Site administration'})
    51     return HttpResponse(t.render(c))
     51    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
    5252
    5353def change_list(request, app_label, module_name):
    5454    from django.core import paginator
     
    491491        'title': (is_popup and 'Select %s' % opts.verbose_name or 'Select %s to change' % opts.verbose_name),
    492492        'is_popup': is_popup,
    493493    })
    494     return HttpResponse(t.render(c))
     494    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
    495495
    496496def _get_flattened_data(field, val):
    497497    """
     
    777777                return HttpResponseRedirect(post_url_continue % new_object.id)
    778778            if request.POST.has_key("_popup"):
    779779                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')
    781782            elif request.POST.has_key("_addanother"):
    782783                request.user.add_message("%s You may add another %s below." % (msg, opts.verbose_name))
    783784                return HttpResponseRedirect(request.path)
     
    840841    raw_template = _get_template(opts, app_label, add=True, show_delete=show_delete, form_url=form_url)
    841842#     return HttpResponse(raw_template, mimetype='text/plain')
    842843    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')
    844845
    845846def change_stage(request, app_label, module_name, object_id):
    846847    mod, opts = _get_mod_opts(app_label, module_name)
     
    956957    raw_template = _get_template(opts, app_label, change=True)
    957958#     return HttpResponse(raw_template, mimetype='text/plain')
    958959    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')
    960961
    961962def _nest_help(obj, depth, val):
    962963    current = obj
     
    10721073        "deleted_objects": deleted_objects,
    10731074        "perms_lacking": perms_needed,
    10741075    })
    1075     return HttpResponse(t.render(c))
     1076    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
    10761077
    10771078def history(request, app_label, module_name, object_id):
    10781079    mod, opts = _get_mod_opts(app_label, module_name)
     
    10901091        'module_name': meta.capfirst(opts.verbose_name_plural),
    10911092        'object': obj,
    10921093    })
    1093     return HttpResponse(t.render(c))
     1094    return HttpResponse(t.render(c), mimetype='text/html; charset=utf-8')
Back to Top