utils to merge and cleanup
This commit is contained in:
parent
17d6da8282
commit
fe62266c4f
1 changed files with 24 additions and 0 deletions
24
utils.py
Normal file
24
utils.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
def upgrade_originals():
|
||||
import item.models
|
||||
import itemlist.models
|
||||
nt = itemlist.models.List.objects.get(name='No Type')
|
||||
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()
|
||||
|
||||
|
||||
def remove_deselected_files():
|
||||
il = itemlist.models.List.objects.get(name='New Originals')
|
||||
for i in il.items.all():
|
||||
for f in i.files.filter(selected=False):
|
||||
f.data.delete()
|
||||
f.delete()
|
Loading…
Reference in a new issue