> What if field_name and value coming from loop? > I have around 50 field and values in loop. > Can I do this? I know this is silly way to do but please guide how can > I do this? > > for key, value in users: > user."%s" = "%s" % (key, value) > > user.save()
Ah, I see. In that case you will want update(), yes, but you can't just pass a string to the method. Use the asterisk to convert a list into arguments, something like (I think): list_of_arguments = ["%s=%s" % (key, value) for key, value in some_dictionary] user.update(*list_of_arguments) Regards Scott -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.