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

context['stimulus_reflex'] KeyError #107

Closed paulik123 closed 3 years ago

paulik123 commented 3 years ago

Bug Report

In the documentation it says: When Sockpuppet calls your Django view, it passes any active instance variables along with a special context variable called stimulus_reflex, which is set to true. You can use this context variable to create an if/else block in your template or view that behaves differently depending on whether it's being called within the context of a Reflex update or not.

But if I write: if not context['stimulus_reflex']: in the view, I get a KeyError and even if i try to use context.get('stimulus_reflex') that doesn't help because the context never gets updated with that key.

jonathan-s commented 3 years ago

Thanks for reporting this!