csrftoken = document.mainform.csrftoken.value; # Do something with the CSRF token, like add dynamic values, like sha256(csrftoken + "dynamicvalue"); document.mainform.csrftoken.value = csrftoken;