Code

Opened 9 years ago

Closed 9 years ago

#533 closed defect (fixed)

Bug in the load_and_render function

Reported by: brantley (deadwisdom@… Owned by: adrian
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: UI/UX:

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))

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [657].

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.