mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	Fixed #2931 -- Use request.method == 'POST' where appropriate in the examples.
Thanks, David Schein. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3914 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -211,7 +211,7 @@ Below is the finished view:: | |||||||
|     def create_place(request): |     def create_place(request): | ||||||
|         manipulator = Place.AddManipulator() |         manipulator = Place.AddManipulator() | ||||||
|  |  | ||||||
|         if request.POST: |         if request.method == 'POST': | ||||||
|             # If data was POSTed, we're trying to create a new Place. |             # If data was POSTed, we're trying to create a new Place. | ||||||
|             new_data = request.POST.copy() |             new_data = request.POST.copy() | ||||||
|  |  | ||||||
| @@ -309,7 +309,7 @@ about editing an existing one? It's shockingly similar to creating a new one:: | |||||||
|         # Grab the Place object in question for future use. |         # Grab the Place object in question for future use. | ||||||
|         place = manipulator.original_object |         place = manipulator.original_object | ||||||
|  |  | ||||||
|         if request.POST: |         if request.method == 'POST': | ||||||
|             new_data = request.POST.copy() |             new_data = request.POST.copy() | ||||||
|             errors = manipulator.get_validation_errors(new_data) |             errors = manipulator.get_validation_errors(new_data) | ||||||
|             if not errors: |             if not errors: | ||||||
| @@ -391,7 +391,7 @@ Here's a simple function that might drive the above form:: | |||||||
|  |  | ||||||
|     def contact_form(request): |     def contact_form(request): | ||||||
|         manipulator = ContactManipulator() |         manipulator = ContactManipulator() | ||||||
|         if request.POST: |         if request.method == 'POST': | ||||||
|             new_data = request.POST.copy() |             new_data = request.POST.copy() | ||||||
|             errors = manipulator.get_validation_errors(new_data) |             errors = manipulator.get_validation_errors(new_data) | ||||||
|             if not errors: |             if not errors: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user