Opened 19 years ago
Closed 19 years ago
#533 closed defect (fixed)
Bug in the load_and_render function
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
def load_and_render(template_name, dictionary=None, context_instance=None): dictionary = dictionary or {} t = template_loader.get_template(template_name) if context_instance: c = context_instance.update(dictionary) else: c = Context(dictionary) return HttpResponse(t.render(c))
This doesn't work right, as context_instance.update doesn't return the context.
This makes more sense:
def load_and_render(template_name, dictionary=None, context_instance=None): dictionary = dictionary or {} t = template_loader.get_template(template_name) if context_instance: context_instance.update(dictionary) else: context_instance = Context(dictionary) return HttpResponse(t.render(context_instance))
Note:
See TracTickets
for help on using tickets.
Fixed in [657].