On 8 avr, 11:25, gintare <g.statk...@gmail.com> wrote: > I do not know how to save changes: > > for Lists in [a.SynGREn, a.SynGREnn]: > ....... > ...... make changes in field by editing Lists, i.e. cropping part of > text: changed_text=crop(Lists, words) > .......Lists=changed_text > ....... a.save() > > HOW to save these changes to model back? > # a.save() does save changes for model field a.SynGREn , > a.SynGREnn
Indeed - you have to reassign the newly computed values to you model instance's attributes. You want something like: for fieldname in ("SynGREn", "SynGREnn"): value = getattr(a, fieldname) new_value = do_something_to(value) setattr(a, fieldname, new_value) a.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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.