You are mixing up views and forms. The OP was asking about forms, not views.

Personally, I'm starting to hit more and more cases where I would like the 
form to be able to access the request (and associated data). For instance, 
being able to limit the queryset of choices for a related field, depending 
upon the logged in user.

(I have an API framework that uses forms for de/serialisation, called 
django-repose, but it's not fully ready for human consumption. I'm still 
thinking about the best way to handle this particular issue, for instance).

Matt.

On Monday, March 12, 2012 6:17:17 PM UTC+10:30, skhohlov wrote:
>
> Shacker,
>  Django migrates  from function based view to the class based. It will
> be nice to catch a good resource about class view usage because
> official documentation is very poor.
>
> 2012/3/12 shacker <shac...@birdhouse.org>:
> > Thanks for the explanations Masklinn and dstuffte - this makes a lot more
> > sense now. I guess I was thinking of this in more simplistic terms - I 
> was
> > assuming that a form is always invoked from a view, so naturally it would
> > inherit the request object. I'm having trouble thinking of  a use case 
> where
> > a  form would  not be part of any request/response cycle, but if that 
> were
> > true, then you're right - it would not be necessarily connected to 
> request.
> >
> >
> > Also, I see that part of the problem is that a view is a *function* and 
> its
> >  args  are passed context objects, while a form is a *class* and its 
>  args
> > are only what class it inherits from - so yeah, there's a semantics 
> problem
> > of how one would pass in request.
> >
> > And you're right, it's not a hard problem to solve - just that the 
> solution
> > is a bit more verbose than I'd like it to be.
> >
> > Thanks again,
> > ./s
> >>
> >>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/G0UkLvyadAgJ.
> >
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/K1w7NHduiAgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to