A small library that provides a form class that signs a configurable set of hidden fields using django.core.signing.
The most common use case for such a form is when the view that handles the post differs from the view that sets up the form, but you need to pass some information from one view to the other, without evil hackers tampering with your precious data.
Usage
Subclass SignedForm, and define which fields should be signed:
from signedforms.forms import SignedForm
class MyForm(SignedForm):
signed_fields = ['redirect_url',]
redirect_url = forms.CharField(required=False, widget=forms.HiddenInput)
In the form that sets up the view, provide the data to be signed in the initial dictionary:
my_form = MyForm(initial={'redirect_url': self.request.path_info})
and in the view that handles the posted form:
def form_valid(self, form):
# do some work
return HttpResponseRedirect(form.cleaned_data['redirect_url'])
Metadata
Release files for django-signedforms 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-signedforms-0.2.tar.gz | 4.0 kB | Details |
Release files / django-signedforms-0.2.tar.gz
| Download URL | django-signedforms-0.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a54511a8dd80fbf65f7d147ee042d6d30e2a225688d78478fc821d56c61f00b
|
|
BLAKE2b-256 checksum How to use checksums |
fd7cab7e420ed3f7865c1eb23034fecdc4a84828f0e337ec65fd60effaa37c41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |