• Home
  • Most Popular
  • Submit
  • About Us
  • Contact Us

Softpile

Free Downloads

Categories
  • Home
  • Most Popular
  • Communications
  • Desktop
  • Games & Entertainment
  • Graphic Apps
  • Network & Internet
  • Security & Privacy
  • System Utilities
Alternative to itextsharp 2022.11.10347
IronPDF offers an itextsharp alternative for HTML to PDF conversion with C# code examples, documentation, and ...
VShell Server for Linux and Mac 4.8
VShell is a versatile and secure file transfer server that supports multiple protocols and is compatible ...
PDF Studio PDF Editor for Linux 2022
PDF Studio is a cost-effective PDF editor that delivers full compatibility with the PDF Standard. It's ...
VQ Probe for Linux 1.5
VQ Probe is a comprehensive software tool that enables objective and subjective video quality analysis. The ...
Resilient Server 2.3
This Debian GNU/Linux (Buster) based software has a customized partitioning scheme that enhances robustness against filesystem ...
Valentina Studio for Linux 9.6
Valentina Studio is a cross-platform GUI manager for Mac, Windows, and Linux. It allows users to ...
VPN Lifeguard for Linux 1.0.58
The software monitors VPN connection and automatically terminates apps during connection loss, re-establishes the connection and ...
G_Viewer 0.84
G_Viewer is a Linux software that serves as both a file system and photo/image viewer. It ...
Checksome File Hash Tool for Linux 1.1
This software allows for the generation and verification of file hashes. It is a quick and ...
KeyWrangler Password Manager for Linux 1.2
A password management software that is secure, offline and extensible. It offers military-grade encryption to protect ...
Home Linux django-safeform Download

django-safeform

September 20, 2009
Get CSRF protection for Django forms with this software. Increase security for your web application and protect against Cross-Site Request Forgery attacks in just a few clicks.
Version 2.0.0
License BSD License
Platform Linux
Supported Languages English
Homepage www.sslinks.co.uk
Developed by Simon Willison
Django-safeform is a highly effective software that provides Cross-Site Request Forgery (CSRF) protection for Django, implemented at the form level. The most remarkable feature of this software is that it requires no middleware. There are two simple steps involved in protecting a Django form with Django-safeform.

Firstly, you need to wrap the form with the SafeForm class decorator which automatically adds a hidden csrf_token field to your form. This decorator also includes validation logic for checking if the csrf_token value is correct. It also slightly changes the signature of the form class. You can see an example of this below.

Secondly, you need to apply the @csrf_protect middleware to the view that contains the form to ensure that a _csrf_cookie is properly set. Once you have done all that, simply run the "./manage.py runserver" command in the examples folder, and you are good to go. You can also run the "./manage.py test" command in the same directory to run the unit tests.

For example usage, you can import the necessary classes, including SafeForm and csrf_protect, from Django. You can create a ChangePasswordForm class with two password input fields, wrap it with the SafeForm decorator, and apply the csrf_protect middleware to your view. Then, within your view, you can create an instance of ChangePasswordForm and check if it is valid. If it is, you can change the user's password and return an HttpResponse.

A: It's important to note that the constructor for the ChangePasswordForm class passes the entire request object, not just request.POST.
B: SafeForm conveniently takes care of binding your form to a set of input data. You no longer have to check if request.method == 'POST'.

If you're using a custom form template, you will have to remember to explicitly output the hidden csrf_token field in your template. However, if you use one of the form rendering helper methods like {{ form.as_p }}, SafeForm will automatically output the csrf_token field for you. A sample custom template is shown below:

{{ form.non_field_errors }}
New password {{ form.password }}.

Overall, Django-safeform is a valuable software that provides a secure solution to CSRF protection for Django at the form level without the need for middleware implementation.
What's New

Version 2.0.0: N/A

Free Download 12K
303
  • Share on:

Most Popular

  1. Quicksilver Forums 1.4.2
    154
  2. Dvgrab 3.4
    102
  3. DynVPN 1.0
    89
  4. CherryTV 0.1
    81
  5. SlideMap 1.2.2
    80
  6. porm r2
    73
  7. Clewarecontrol 0.8
    72
  8. Java Games 1.0
    72
  9. Swiftfox 3.0b5pre-2
    71
  10. fuseftp 0.8
    71

Related Downloads

SILVERCODERS SqlSync
The SqlSync utility by SILVERCODERS enables comparing data in two SQL databases ...
FileCommander
FileCommander is a file management software that runs on multiple platforms and ...
uhuhu
Uhuhu is a Linux game software designed for gaming enthusiasts to enjoy ...
eyeIRC
eyeIRC, an IRC client designed for eyeOS, allows users to chat with ...
django-oauth
Django OAuth is a plugin that enables OAuth support in Django. OAuth ...
nLive Core
nLive Core is a web-based Linux server software with a user-friendly interface ...
Network Chemistry RogueScanner
RogueScanner is an open-source tool used for vulnerability management.
EasiLiX
EasiLiX is a distribution that offers a menu-driven interface to configure services, ...
Chevna
Chevna is a Linux Operating System that has similar features to Windows, ...
wbar_util
Wbar_util simplifies the management of wbar launchers via a configuration utility.
Copyright © 1999-2025 Softpile Free Downloads
  • Most Popular
  • Submit
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Terms of Use

Can we use your data to tailor ads for you?

Our partners will collect data and use cookies for ad personalization and measurement.

By choosing "I agree", closing this pop-up or clicking on any element on the page, you agree to the use of cookies to help us provide you with a better user experience.

Learn how Softpile and our partners collect and use data.

You can change your choice at any time in our privacy center.

Cookie Settings

Our website stores four types of cookies. At any time you can choose which cookies you accept and which you refuse. You can read more about what cookies are and what types of cookies we store in our Cookie Policy.

are necessary for technical reasons. Without them, this website may not function properly.

are necessary for specific functionality on the website. Without them, some features may be disabled.

allow us to analyse website use and to improve the visitor's experience.

allow us to personalise your experience and to send you relevant content and offers, on this website and other websites.