-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
{% csrf_token %}
not available inside component HTML
#12
Comments
Excellent question, this is something I have totally missed. I'll have a look and see if I can find a way to propagate the requestcontext down into a component, I think that is what people would expect. I have lots of other things going on, but I'll see if I can find some time during the weekend. A PR would be appreciated though :) |
Thanks @EmilStenstrom I'll try to dig into the library a bit at the end of the week. |
I have looked at this for a couple of hours with no luck. The problem is that I can't manage to get a good testcase going. There are sooo many moving parts involved with csrf, and most current tests are at the unit test level. If you have the time and know how to create a failing test for csrf_token, please help me out! |
@Buroni I just released django-reusable-components 0.5 to pypi, in which @rbeard0330 reworked context handling. Would you mind trying to call csrf_token inside a component again to see of things work now? |
Firstly thanks for creating this useful library.
I've noticed that
{% csrf_token %}
isn't rendered when used inside component template HTML. Other default Django template tags seem to work, so I'm guessing this is because the component HTML doesn't have access to Django'sRequestContext
.A work-around is to just pass down the
{% csrf_token %}
inside aslot
from the parent component, however this becomes repetitive. I'm wondering if it's currently possible to give the component access to the necessary context. Cheers!The text was updated successfully, but these errors were encountered: