Ticket #3079: django_handle_post_arg.diff
File django_handle_post_arg.diff, 2.4 KB (added by , 18 years ago) |
---|
-
django/views/generic/create_update.py
10 10 11 11 def create_object(request, model, template_name=None, 12 12 template_loader=loader, extra_context=None, post_save_redirect=None, 13 login_required=False, follow=None, context_processors=None ):13 login_required=False, follow=None, context_processors=None, handle_post=True): 14 14 """ 15 15 Generic object-creation function. 16 16 … … 24 24 return redirect_to_login(request.path) 25 25 26 26 manipulator = model.AddManipulator(follow=follow) 27 if request.POST :27 if request.POST and handle_post: 28 28 # If data was POSTed, we're trying to create a new object 29 29 new_data = request.POST.copy() 30 30 … … 74 74 slug_field=None, template_name=None, template_loader=loader, 75 75 extra_context=None, post_save_redirect=None, 76 76 login_required=False, follow=None, context_processors=None, 77 template_object_name='object' ):77 template_object_name='object', handle_post=True): 78 78 """ 79 79 Generic object-update function. 80 80 … … 104 104 105 105 manipulator = model.ChangeManipulator(getattr(object, object._meta.pk.attname), follow=follow) 106 106 107 if request.POST :107 if request.POST and handle_post: 108 108 new_data = request.POST.copy() 109 109 if model._meta.has_field_type(FileField): 110 110 new_data.update(request.FILES) … … 148 148 def delete_object(request, model, post_delete_redirect, 149 149 object_id=None, slug=None, slug_field=None, template_name=None, 150 150 template_loader=loader, extra_context=None, 151 login_required=False, context_processors=None, template_object_name='object' ):151 login_required=False, context_processors=None, template_object_name='object', handle_post=True): 152 152 """ 153 153 Generic object-delete function. 154 154 … … 178 178 except ObjectDoesNotExist: 179 179 raise Http404, "No %s found for %s" % (model._meta.app_label, lookup_kwargs) 180 180 181 if request.method == 'POST' :181 if request.method == 'POST' and handle_post: 182 182 object.delete() 183 183 if request.user.is_authenticated(): 184 184 request.user.message_set.create(message=gettext("The %(verbose_name)s was deleted.") % {"verbose_name": model._meta.verbose_name})