Open coleifer opened 12 years ago
Awesome! This is 100% a better solution — I hadn't even thought of using @app.context_processor
.
Thank you. I'll update the app and page accordingly tonight.
So glad you like it! No problemo, glad i could help. +1 for using flask :)
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