I'm trying to do a Django database save from a form where I don't have to manually specify the fieldnames (as I do in the 2nd code block), the way I am trying to do this is as below (1st code block) as I got the tip from another S.O. post. However, when I try this I get the error "dictionary update sequence element #0 has length 4; 2 is required", I even tried it, as below, with just a testdict dictionary, instead of the request.POST, but am still getting the error.. obviously the field value is fine since it works in the 2nd code block, so I am stumped as to why this is happening, would appreciate if anyone can shed any light on this for me... thanks
trying it this way gives the error:
testdict = {'name':'account_username','value':'vvvvvv'}
for name, value in testdict.iteritems():
if name != '' and name != 'top_select':
b = Twitter(**dict((name, value)))
b.save()
>>> dictionary update sequence element #0 has length 4; 2 is required
but this works fine:
b = Twitter(account_username='vvvvvv')
b.save()