2023-10-21 14:33:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
def upgrade_originals():
|
|
|
|
import item.models
|
|
|
|
import itemlist.models
|
|
|
|
nt = itemlist.models.List.objects.get(name='No Type')
|
2023-10-28 09:24:43 +00:00
|
|
|
no = itemlist.models.List.objects.get(name='New Originals')
|
2023-10-21 14:33:28 +00:00
|
|
|
for i in nt.get_items(nt.user):
|
|
|
|
orig = item.models.Item.objects.get(data__title=i.get('title'), data__type=["Original"])
|
|
|
|
print(i, orig)
|
|
|
|
orig.files.all().update(selected=False)
|
|
|
|
i.files.all().update(item=orig)
|
|
|
|
orig.save()
|
|
|
|
orig.remove_poster()
|
|
|
|
orig.make_poster()
|
|
|
|
i.data['type'] = ['Empty']
|
|
|
|
i.save()
|
2023-10-28 09:24:43 +00:00
|
|
|
no.items.add(orig)
|
2023-10-21 14:33:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
def remove_deselected_files():
|
2023-10-28 09:24:43 +00:00
|
|
|
import itemlist.models
|
2023-10-21 14:33:28 +00:00
|
|
|
il = itemlist.models.List.objects.get(name='New Originals')
|
|
|
|
for i in il.items.all():
|
2023-10-21 14:46:08 +00:00
|
|
|
changed = False
|
2023-10-21 14:33:28 +00:00
|
|
|
for f in i.files.filter(selected=False):
|
|
|
|
f.data.delete()
|
|
|
|
f.delete()
|
2023-10-21 14:46:08 +00:00
|
|
|
changed = True
|
|
|
|
if changed:
|
|
|
|
i.save()
|
|
|
|
|