how to save django object using dictionary?

Posted by shahjapan on Stack Overflow See other posts from Stack Overflow or by shahjapan
Published on 2010-04-23T07:03:16Z Indexed on 2010/04/23 7:13 UTC
Read the original article Hit count: 251

Filed under:
|

is there a way that I can save the model by using dictionary

for e.g. this is working fine,

p1 = Poll.objects.get(pk=1)

p1.name = 'poll2'
p1.descirption = 'poll2 description'

p1.save()

but what if I have dictionary like { 'name': 'poll2', 'description: 'poll2 description' }

is there a simple way to save the such dictionary direct to Poll

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models