diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py
index 76575f9..c05137b 100644
a
|
b
|
def lookup_object(model, object_id, slug, slug_field):
|
91 | 91 | raise Http404("No %s found for %s" |
92 | 92 | % (model._meta.verbose_name, lookup_kwargs)) |
93 | 93 | |
94 | | def create_object(request, model=None, template_name=None, |
| 94 | def create_object(request, instance=None, model=None, template_name=None, |
95 | 95 | template_loader=loader, extra_context=None, post_save_redirect=None, |
96 | 96 | login_required=False, context_processors=None, form_class=None): |
97 | 97 | """ |
… |
… |
def create_object(request, model=None, template_name=None,
|
106 | 106 | if login_required and not request.user.is_authenticated(): |
107 | 107 | return redirect_to_login(request.path) |
108 | 108 | |
| 109 | if model is None and instance is not None: |
| 110 | model = instance.__class__ |
| 111 | |
109 | 112 | model, form_class = get_model_and_form_class(model, form_class) |
110 | 113 | if request.method == 'POST': |
111 | | form = form_class(request.POST, request.FILES) |
| 114 | form = form_class(request.POST, request.FILES, instance=instance) |
112 | 115 | if form.is_valid(): |
113 | 116 | new_object = form.save() |
114 | 117 | |