Ticket #1563: generic-views-manipulator.2.diff
File generic-views-manipulator.2.diff, 1.8 KB (added by , 19 years ago) |
---|
-
django/views/generic/create_update.py
a b from django.core.exceptions import Objec 10 10 11 11 def create_object(request, model, template_name=None, 12 12 template_loader=loader, extra_context={}, post_save_redirect=None, 13 login_required=False, follow=None, context_processors=None): 13 login_required=False, follow=None, context_processors=None, 14 manipulator = None): 14 15 """ 15 16 Generic object-creation function. 16 17 … … def create_object(request, model, templa 21 22 """ 22 23 if login_required and request.user.is_anonymous(): 23 24 return redirect_to_login(request.path) 24 25 manipulator = model.AddManipulator(follow=follow) 25 26 if manipulator == None: 27 manipulator = model.AddManipulator(follow=follow) 26 28 if request.POST: 27 29 # If data was POSTed, we're trying to create a new object 28 30 new_data = request.POST.copy() … … def update_object(request, model, object 73 75 slug_field=None, template_name=None, template_loader=loader, 74 76 extra_lookup_kwargs={}, extra_context={}, post_save_redirect=None, 75 77 login_required=False, follow=None, context_processors=None, 76 template_object_name='object'): 78 template_object_name='object', 79 manipulator = None): 77 80 """ 78 81 Generic object-update function. 79 82 … … def update_object(request, model, object 101 104 except ObjectDoesNotExist: 102 105 raise Http404, "No %s found for %s" % (model._meta.verbose_name, lookup_kwargs) 103 106 104 manipulator = model.ChangeManipulator(object.id, follow=follow) 107 if manipulator == None: 108 manipulator = model.ChangeManipulator(object.id, follow=follow) 105 109 106 110 if request.POST: 107 111 new_data = request.POST.copy()