applegrew / django-select2

This is a Django integration for Select2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default CSRF validation with django

tiagob opened this issue · comments

In heavy_data.js your overriding the cookie which is used for CSRF in django forms.

Form submission fails with:
Forbidden (403)
CSRF verification failed. Request aborted.

Reason given for failure:
CSRF cookie not set.

Can you please provide more details? I did not see this problem before.

I have 188 selected values. I'm using google chrome. It seems that my document.cookie can only take 75 of them before it starts replacing the ones it just set and the csrf token too in setCookie in heavy_data.js.

I got it working by replacing the cookie code in heavy_data.js with https://github.com/marcuswestin/store.js

Oops. Good catch! Yes there is usually a max limit of 4KB limit on cookies. In your case you are hitting that at 75 elements. I will incorporate your suggestion in heavy_data.js.

Please update to latest version. Noe django_select2 does not use cookies or localStorage at all.