zachwill/pjax_flask — Issue #1: Less-invasive way of accomplishing the same
Author: coleifer
Created: 2011-12-29 19:14:34+00:00
State: open

The approach you describe is very invasive as it requires you to use a special function to render templates depending on whether it is pjax or not. It also does not allow for very good reuse of template blocks.

I use a different approach which comes at it the other way - via the templates. Essentially it entails swapping out base template based on whether the request is pjax or not. It does not require any special code inside the your flask application and does not require you to do anything differently in the templates. Here's a gist showing how I've set it up:

https://gist.github.com/0ffdd627542cf0de8af4