Thanks! Yep, it was a problem with the keyword argument 'user'. Solved the issue by first calling the argument 'my_user' and not explicitly stating it in the __init__ function signature.
def __init__(self, *args, **kwargs): user = kwargs.pop('my_user', False) ... On Jun 14, 2:25 am, Karen Tracey <kmtra...@gmail.com> wrote: > On Sun, Jun 13, 2010 at 7:06 PM, Jani Rahkola <jani.rahk...@gmail.com>wrote: > > > > > Hei, > > > I hope someone could shed some light on this one. > > I have these in their appropriate files: > > > class ShoppinglistForm(ModelForm): > > > def __init__(self, user=False, *args, **kwargs): > > ModelForm.__init__(self, *args, **kwargs) > > self.fields['pantry'].empty_label = None > > if user: > > self.fields['pantry'].queryset = > > Product.objects.filter(owner=user) > > > class Meta: > > model = Shoppinglist > > > def new(request): > > if request.method == 'POST': > > form = ShoppinglistForm(request.POST) > > You need to pass user=request.user here, as you do for the non-POST case. > Whatever it is ending up being from request.POST or the default arguments to > the __init__ function is not working. > > Karen > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.