Hi,
-- I'm struggling with the concepts of get and post and where these status come from in the workflow. I have worked my way through the official pages on forms but I have not quite understood this to my satisfaction.
I get the gist that:
- get is for requesting data and
- the query string parameters are visible
- Running multiple get operations with say a bookmarked link has no negative effect
- post is for making database changes
Beyond this I am a little clueless.
- When does a request method get assigned?
- In other words, with this code below, what would have made the request method become post (or get)? Is this related to a preceding view?
- Does a request object have to have a get or a post dictionary in it? Could it have neither?
- Does a request object going to a form have to have a get or a post dictionary in it?
- Is it the case that with "add_category.html" the page could open with neither a get or post in the request, and while the "add_category" view is running the request method POST could be assigned?
- Does a POST method invoke form validation?
Example:
def add_category(request, category_name_url=""):
context = RequestContext(request)
if request.method == 'POST':
form = CategoryForm(request.POST)
if form.is_valid():
form.save(commit=True)
return index(request)
else:
print form.errors
else:
form = CategoryForm
return render_to_response('rango/add_category.html', {'form': form}, context)
Thanks,
Andy
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6367ae1d-fc71-4137-9140-3573a8a5dedc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment