Is it possible to access the current User
(i.e. user
in the template context) from a custom template filter?
Obviously I can pass the user in as an argument, but if it's possible to just grab the current user, that would be more convenient.
Django filters aren't given any special access to the context from which they are called, they're just plain old functions.
You'll need to pass in anything you want to use within the function.
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With