On 2012-03-11, at 17:43 , shacker wrote:
> On Sunday, March 11, 2012 6:24:30 AM UTC-7, skhohlov wrote:
>> 
>> Of course form  does not have access to the object. 
> 
> 
> skholov - Thanks, but you misunderstand my question. Again, I know that 
> forms don't have access to request, and again, I've got it working already 
> (though with a different approach - see my OP). My question was an attempt 
> to understand the plumbing or the python better. To reiterate, I'd like to 
> know WHY request isn't automatically available from forms, as it is from 
> views.

1. Because there are no paths to do it automatically, this would require
passing the request object to all forms explicitly

2. Because, as Donald noted, forms don't *need* a request object and
indeed can be used completely independently from the request/response
cycle (or from a given request).

3. Plus what would be the semantics there, would the form prime itself
using request.POST? request.GET? A combination of both? Only under some
request methods?

Views exist to handle requests, that's all their job is, so them
receiving a request object makes perfect sense. Not so for forms.

> To put the question another way, when we define a view function, we 
> do something like:
> 
> def edit(request,story_id):
>  ...
> 
> But when we create a form, we can't just do:
> 
> class StoryForm(ModelForm, request):
>  …

For what it's worth, this code makes absolutely no sense, it tries to
create a class which inherits from a request object (which is not in
scope and is not a type)


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to