Changed a slightly suspicious usage of request.POST to request.method == 'POST'.

Refs #9014 (not the root cause of that bug, but discovered whilst people were
diagnosing it).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9063 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-09-17 08:59:55 +00:00
parent a10fcbdb8b
commit 0aff292bcf
1 changed files with 1 additions and 1 deletions

View File

@ -558,7 +558,7 @@ class ModelAdmin(BaseModelAdmin):
if obj is None: if obj is None:
raise Http404('%s object with primary key %r does not exist.' % (force_unicode(opts.verbose_name), escape(object_id))) raise Http404('%s object with primary key %r does not exist.' % (force_unicode(opts.verbose_name), escape(object_id)))
if request.POST and request.POST.has_key("_saveasnew"): if request.method == 'POST' and request.POST.has_key("_saveasnew"):
return self.add_view(request, form_url='../../add/') return self.add_view(request, form_url='../../add/')
ModelForm = self.get_form(request, obj) ModelForm = self.get_form(request, obj)