Boris Ozegovic <[EMAIL PROTECTED]> writes: > > def filter(self, **kw): > > for argname, value in kw.items(): > > fieldname, op = argname.split('__', 1) > > Yes, this is what confused me in the first place: how to separate > arguments. If you call split, and split returns list of String, then you > have fieldname = 'question' and startwith = 'what', and not references at > question and startwith, or am I missing something big.
Oh, I understand your question now. The call was: Poll.objects.filter(question__startswith='What') 'filter' receives the argument 'kw', which is a dictionary whose value will be { 'question__startswith' : 'What' } That means the "for argname, value" loop iterates just once, with argname = 'question__startswith' and value = 'What' Since split is applied to argname, it retrieves 'question' and 'startswith'. -- http://mail.python.org/mailman/listinfo/python-list