James Mulholland wrote: > Suppose I have a dictionary like this: > > data = { 'a':'1', 'b':'2', 'c':'3' } > > and a model like this: > > class Test(models.Model): > a = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > b = models.CharField(maxlength=8) > > I would like (in a python script) to be able to say > > t = Test(data) > t.save() > > and have The Right Thing occur. Unfortunately, the script barfs at > t.save(). Is there a way to do this?
This should work: t = Test(**data) t.save() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---