Code

Opened 7 years ago

Closed 7 years ago

#3079 closed enhancement (worksforme)

[patch] allow to disable POST handling in create_update generic views

Reported by: Bastian Kleineidam <calvin@…> Owned by: jacob
Component: Generic views Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Suppose you have custom templates for the create_update generic views with more than one form. Then one needs to ensable the POST processing of the generic views only for one single form, and disable it for all the others (supposing of course the form actions all lead to the same view handler function).

This patch adds an additional keyword parameter handle_post=True, which if set to False prevents the object deletion/creation/edit even if the request method is a POST.

The patch is backwards compatible because the default value is True.

Attachments (1)

django_handle_post_arg.diff (2.4 KB) - added by Bastian Kleineidam <calvin@…> 7 years ago.
add handle_post keyword arg

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Bastian Kleineidam <calvin@…>

add handle_post keyword arg

comment:1 Changed 7 years ago by ubernostrum

Couldn't the same effect be achieved more easily with a wrapper view?

comment:2 Changed 7 years ago by Simon G. <dev@…>

  • Resolution set to worksforme
  • Status changed from new to closed

worksforme given Ubernostrum's comment above. Do feel free to convince us otherwise though :)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.