Update model instance with dynamic field names
        Posted  
        
            by herpderp
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by herpderp
        
        
        
        Published on 2010-05-30T05:27:58Z
        Indexed on 
            2010/05/30
            5:32 UTC
        
        
        Read the original article
        Hit count: 198
        
django
What I want to do is pretty simple:
f=Foobar.objects.get(id=1)
foo='somefield'
bar='somevalue'
f.foo=bar
f.save()
This doesn't work as it tries to update the f object's 'foo' field, which of course doesn't exist. How can I accomplish this?
© Stack Overflow or respective owner