jonathan-s / django-sockpuppet

Build reactive applications with the django tooling you already know and love.
https://github.com/jonathan-s/django-sockpuppet
MIT License
450 stars 22 forks source link

Don't call get_context_data more than necessary #124

Closed jonathan-s closed 3 years ago

jonathan-s commented 3 years ago

Description

Figuring out which view it is and adding the correct property to that view is better than trying to re-render the view itself.

This should solve for django's generic views. It won't work for Django vanilla views package, but we can deal with this later if someone show interest for that.

Why should this be added

It removes the rendering of the view once, so it will be marginally faster. It also makes it easier to reason about what is happening.

Checklist