save changes

This commit is contained in:
j 2016-01-08 16:23:14 +05:30
parent d4a961f470
commit 11a20a5063

View file

@ -296,7 +296,7 @@ def upgrade_db(old, new=None):
sql = 'CREATE UNIQUE INDEX IF NOT EXISTS useritem_index on useritem(user_id,item_id)' sql = 'CREATE UNIQUE INDEX IF NOT EXISTS useritem_index on useritem(user_id,item_id)'
session.execute(sql) session.execute(sql)
session.commit() session.commit()
if old <= '20160108-551-7c23bfb': if old <= '20160108-555-d4a961f' and new and new < "20160108-565-d4a961f":
with db.session() as session: with db.session() as session:
import item.models import item.models
from meta.utils import decode_html_data from meta.utils import decode_html_data
@ -312,10 +312,12 @@ def upgrade_db(old, new=None):
if meta != i.meta: if meta != i.meta:
#print(i, i.meta, meta) #print(i, i.meta, meta)
i.meta = meta i.meta = meta
changed = True
info = decode_html_data(i.info.copy()) info = decode_html_data(i.info.copy())
if info != i.info: if info != i.info:
#print(i, i.info, info) #print(i, i.info, info)
i.info = info i.info = info
changed = True
if changed: if changed:
i.save() i.save()