You can certainly pass request.user to the form from your view.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
You're welcome. The one 'gotcha' is that you're going to have to
remove the user from the kwargs before you call the __init__ of the
superclass. Otherwise you'll get an 'unexpected keyword argument'
exception.
Example:
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super(MyForm, self).__init__(*args, **kwargs)
You can then use self.user in your form's functions for filtering --
probably starting right in __init__ after the super() call to set
self.fields['field_name'].choices to be whatever they should be.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.