add all files in one folder to one item
This commit is contained in:
parent
0a07097f22
commit
15e0d9a633
1 changed files with 8 additions and 1 deletions
|
@ -178,6 +178,13 @@ class File(models.Model):
|
|||
if info.get('director') and info.get('directorSort'):
|
||||
for name, sortname in zip(info['director'], info['directorSort']):
|
||||
get_name_sort(name, sortname)
|
||||
#add all files in one folder to same item
|
||||
if self.instances.all().count():
|
||||
folder = os.path.dirname(self.instances.all()[0].path)
|
||||
qs = item.models.Item.objects.filter(files__instances__path__startswith=folder)
|
||||
if qs.exists():
|
||||
self.item = qs[0]
|
||||
if not self.item:
|
||||
self.item = item.models.get_item(info, user)
|
||||
for key in self.AV_INFO + self.PATH_INFO:
|
||||
if key in info:
|
||||
|
|
Loading…
Reference in a new issue