Fix datagrid template rendering on Django 1.8.

Review Request #7431 — Created June 16, 2015 and submitted

Information

Djblets
release-0.9.x
f12514f...

Reviewers

Since datagrids must render each and every cell, we do a bunch of
optimizations to prevent all the expensive template machinery from
running on each render. We cached the contents of a RequestContext,
turning it into a standard Context, and overrode the variables. This
prevented a bunch of template context stack manipulation and data
fetching.

In Django 1.8, the template support has been rewritten for multiple
backends. Now, a RequestContext is empty until bound to a template,
which happens just before the render, and cleared just after. Now,
instead of a RequestContext being populated once during instantiation,
it's populated for each template, making it really expensive. It also
just didn't work.

We now create a dummy template and manually bind the RequestContext to
it. This gives us a populated RequestContext we can work with.

The datagrid works again on both Django 1.6 and 1.8.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/datagrid/grids.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/datagrid/grids.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.9.x (85a477f)
Loading...