The solution I eventually used is to require that the reviewer queryset be stored in a session variable. Since this queryset is required in the template context in order for the templatetags to work, saving the value in a session variable isn't much to ask.
Please let me know if you think this solution is problematic in nature. Thanks! Graham On Aug 19, 5:56 pm, grahamu <gra...@flyingcracker.com> wrote: > In general, I'm wondering how to retrieve a Queryset provided to a > Form (choices for a ManyToMany field) from within a view that only > accepts POST data from that form. This isn't really a question about > extending django.contrib.comments, but that framework provides a good > point of reference for the issue. > > For example, suppose I wanted to add: "reviewers = models.ManyToMany > (User)" to the django.contrib.comment Comment model. This would be a > list of Users who are allowed to review the comment, specified by the > comment creator. > > In order for this to work we need to provide a Queryset of Users when > creating the form. This can be accomplished with a template tag of the > form "{% get_comment_form for [object] with [reviewers] as [varname] > %}", where 'reviewers' is a Queryset passed in the template context. > This works fine. > > However, when the form is posted, we don't have visibility (in the > post view) to the Queryset of possible reviewers. The post view, after > checking the validity of several other pieces of data, creates a new > comment form to check the validity of the received data. Of course the > form must have a Queryset for the 'reviewers' field, and this isn't > part of the request POST data. > > Any ideas how one might either pass the queryset data to the view in > the form, or some other way to manage the form validation in this > situation? > > Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. 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 -~----------~----~----~----~------~----~------~--~---