-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render_block breaks django permission with htmx rendered template? #50
Comments
This happens only when using render_block_to_string(), otherwise ok if i use TemplateResponse() |
Can you provide a more complete example of the issue you're running into? What is |
Ok, I will try to re-create the case. I did not pursue it coz i read
somewhere (i think in htmx essay) that render_block somewhat discourages
the use of django permissions in the template, and in favor of checking the
user permissions rather in views.
…On Tue, Apr 16, 2024 at 3:38 AM Patrick Cloke ***@***.***> wrote:
Can you provide a more complete example of the issue you're running into?
What is perms? What are the results from render_block_to_string vs
TemplateResponse?
—
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APGPA5SRNBUDLNQ44PJLSTDY5QUC5AVCNFSM6AAAAABFQ774BOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXGY3DMOBTHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
If you have a reference to the article that would be helpful too. In general handling any sort of business logic in templates is usually a bad idea though. |
Here's a link (https://github.com/gmaz-tauruz/render-block-testing) of the
stripped down version of the app I tried to re-create. Though, I wasn't
able to re-create the different results with using render_block_to_string()
vs TemplateResponse() - they both produced the same result where {{ perms
}} (
https://docs.djangoproject.com/en/5.0/topics/auth/default/#permissions-and-authorization)
seems not recognized.
|
I'm thinking this issue is happening because |
Sounds like a bug -- it should act the same as the normal render function. |
In the rendered template via htmx ajax call, { % perms.foo.change_bar %} will not work, and {{ perms }} returns empty?
The text was updated successfully, but these errors were encountered: