[Answer]-How to replace with the new tag values in the table?

1👍

The issue is with the following lines:

for i in range(len(tags)):
    tagsobj = tagobj.update(name = tags[i], event_id = key)

You are calling update on a QuerySet tagobj, which will update all tags in the QuerySet. So all your tags will have the value of the last tag.

If I understand your question correctly, it should work if you update each individual tag.

i = 0
for tag_item in tagobj:
    tag_item.update(name=tags[i], event_id=key)
    i +=1

Leave a comment