forked from 0x2620/pandora
Instance
This commit is contained in:
parent
b483f330c2
commit
b7ae5b70a9
12 changed files with 53 additions and 53 deletions
|
@ -13,9 +13,9 @@ class FileAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
admin.site.register(models.File, FileAdmin)
|
admin.site.register(models.File, FileAdmin)
|
||||||
|
|
||||||
class FileInstanceAdmin(admin.ModelAdmin):
|
class InstanceAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['path', 'volume__name']
|
search_fields = ['path', 'volume__name']
|
||||||
#form = ArchiveFileAdminForm
|
#form = ArchiveFileAdminForm
|
||||||
|
|
||||||
admin.site.register(models.FileInstance, FileInstanceAdmin)
|
admin.site.register(models.Instance, InstanceAdmin)
|
||||||
|
|
||||||
|
|
|
@ -77,19 +77,19 @@ class Migration:
|
||||||
))
|
))
|
||||||
db.send_create_signal('archive', ['File'])
|
db.send_create_signal('archive', ['File'])
|
||||||
|
|
||||||
# Adding model 'FileInstance'
|
# Adding model 'Instance'
|
||||||
db.create_table('archive_fileinstance', (
|
db.create_table('archive_fileinstance', (
|
||||||
('id', orm['archive.FileInstance:id']),
|
('id', orm['archive.Instance:id']),
|
||||||
('created', orm['archive.FileInstance:created']),
|
('created', orm['archive.Instance:created']),
|
||||||
('modified', orm['archive.FileInstance:modified']),
|
('modified', orm['archive.Instance:modified']),
|
||||||
('published', orm['archive.FileInstance:published']),
|
('published', orm['archive.Instance:published']),
|
||||||
('accessed', orm['archive.FileInstance:accessed']),
|
('accessed', orm['archive.Instance:accessed']),
|
||||||
('path', orm['archive.FileInstance:path']),
|
('path', orm['archive.Instance:path']),
|
||||||
('folder', orm['archive.FileInstance:folder']),
|
('folder', orm['archive.Instance:folder']),
|
||||||
('file', orm['archive.FileInstance:file']),
|
('file', orm['archive.Instance:file']),
|
||||||
('archive', orm['archive.FileInstance:archive']),
|
('archive', orm['archive.Instance:archive']),
|
||||||
))
|
))
|
||||||
db.send_create_signal('archive', ['FileInstance'])
|
db.send_create_signal('archive', ['Instance'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class Migration:
|
||||||
# Deleting model 'File'
|
# Deleting model 'File'
|
||||||
db.delete_table('archive_file')
|
db.delete_table('archive_file')
|
||||||
|
|
||||||
# Deleting model 'FileInstance'
|
# Deleting model 'Instance'
|
||||||
db.delete_table('archive_fileinstance')
|
db.delete_table('archive_fileinstance')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,19 +67,19 @@ class Migration(SchemaMigration):
|
||||||
# Deleting field 'fileinstance.archive'
|
# Deleting field 'fileinstance.archive'
|
||||||
db.delete_column('archive_fileinstance', 'archive_id')
|
db.delete_column('archive_fileinstance', 'archive_id')
|
||||||
|
|
||||||
# Adding field 'FileInstance.ctime'
|
# Adding field 'Instance.ctime'
|
||||||
db.add_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
db.add_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
# Adding field 'FileInstance.mtime'
|
# Adding field 'Instance.mtime'
|
||||||
db.add_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
db.add_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
# Adding field 'FileInstance.atime'
|
# Adding field 'Instance.atime'
|
||||||
db.add_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
db.add_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
# Adding field 'FileInstance.volume'
|
# Adding field 'Instance.volume'
|
||||||
db.add_column('archive_fileinstance', 'volume', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='files', to=orm['archive.Volume']), keep_default=False)
|
db.add_column('archive_fileinstance', 'volume', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='files', to=orm['archive.Volume']), keep_default=False)
|
||||||
|
|
||||||
# Adding unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
# Adding unique constraint on 'Instance', fields ['volume', 'path', 'folder']
|
||||||
db.create_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
db.create_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,19 +154,19 @@ class Migration(SchemaMigration):
|
||||||
# Adding field 'fileinstance.archive'
|
# Adding field 'fileinstance.archive'
|
||||||
db.add_column('archive_fileinstance', 'archive', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='files', to=orm['archive.Archive']), keep_default=False)
|
db.add_column('archive_fileinstance', 'archive', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='files', to=orm['archive.Archive']), keep_default=False)
|
||||||
|
|
||||||
# Deleting field 'FileInstance.ctime'
|
# Deleting field 'Instance.ctime'
|
||||||
db.delete_column('archive_fileinstance', 'ctime')
|
db.delete_column('archive_fileinstance', 'ctime')
|
||||||
|
|
||||||
# Deleting field 'FileInstance.mtime'
|
# Deleting field 'Instance.mtime'
|
||||||
db.delete_column('archive_fileinstance', 'mtime')
|
db.delete_column('archive_fileinstance', 'mtime')
|
||||||
|
|
||||||
# Deleting field 'FileInstance.atime'
|
# Deleting field 'Instance.atime'
|
||||||
db.delete_column('archive_fileinstance', 'atime')
|
db.delete_column('archive_fileinstance', 'atime')
|
||||||
|
|
||||||
# Deleting field 'FileInstance.volume'
|
# Deleting field 'Instance.volume'
|
||||||
db.delete_column('archive_fileinstance', 'volume_id')
|
db.delete_column('archive_fileinstance', 'volume_id')
|
||||||
|
|
||||||
# Removing unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
# Removing unique constraint on 'Instance', fields ['volume', 'path', 'folder']
|
||||||
db.delete_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
db.delete_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('path', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('path', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
'atime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
'ctime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
|
|
@ -8,28 +8,28 @@ class Migration(SchemaMigration):
|
||||||
|
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
|
|
||||||
# Changing field 'FileInstance.ctime'
|
# Changing field 'Instance.ctime'
|
||||||
db.delete_column('archive_fileinstance', 'ctime')
|
db.delete_column('archive_fileinstance', 'ctime')
|
||||||
db.add_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.IntegerField')())
|
db.add_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.IntegerField')())
|
||||||
|
|
||||||
# Changing field 'FileInstance.mtime'
|
# Changing field 'Instance.mtime'
|
||||||
db.delete_column('archive_fileinstance', 'mtime')
|
db.delete_column('archive_fileinstance', 'mtime')
|
||||||
db.add_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.IntegerField')())
|
db.add_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.IntegerField')())
|
||||||
|
|
||||||
# Changing field 'FileInstance.atime'
|
# Changing field 'Instance.atime'
|
||||||
db.delete_column('archive_fileinstance', 'atime')
|
db.delete_column('archive_fileinstance', 'atime')
|
||||||
db.add_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.IntegerField')())
|
db.add_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.IntegerField')())
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
|
|
||||||
# Changing field 'FileInstance.ctime'
|
# Changing field 'Instance.ctime'
|
||||||
db.alter_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.DateTimeField')())
|
db.alter_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.DateTimeField')())
|
||||||
|
|
||||||
# Changing field 'FileInstance.mtime'
|
# Changing field 'Instance.mtime'
|
||||||
db.alter_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.DateTimeField')())
|
db.alter_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.DateTimeField')())
|
||||||
|
|
||||||
# Changing field 'FileInstance.atime'
|
# Changing field 'Instance.atime'
|
||||||
db.alter_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.DateTimeField')())
|
db.alter_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.DateTimeField')())
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('path', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('path', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5094559'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5094559'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5095601'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5095601'}),
|
||||||
|
|
|
@ -8,31 +8,31 @@ class Migration(SchemaMigration):
|
||||||
|
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
|
|
||||||
# Deleting field 'FileInstance.path'
|
# Deleting field 'Instance.path'
|
||||||
db.delete_column('archive_fileinstance', 'path')
|
db.delete_column('archive_fileinstance', 'path')
|
||||||
|
|
||||||
# Adding field 'FileInstance.name'
|
# Adding field 'Instance.name'
|
||||||
db.add_column('archive_fileinstance', 'name', self.gf('django.db.models.fields.CharField')(default='', max_length=2048), keep_default=False)
|
db.add_column('archive_fileinstance', 'name', self.gf('django.db.models.fields.CharField')(default='', max_length=2048), keep_default=False)
|
||||||
|
|
||||||
# Removing unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
# Removing unique constraint on 'Instance', fields ['volume', 'path', 'folder']
|
||||||
#db.delete_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
#db.delete_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
# Adding unique constraint on 'FileInstance', fields ['volume', 'folder', 'name']
|
# Adding unique constraint on 'Instance', fields ['volume', 'folder', 'name']
|
||||||
db.create_unique('archive_fileinstance', ['volume_id', 'folder', 'name'])
|
db.create_unique('archive_fileinstance', ['volume_id', 'folder', 'name'])
|
||||||
|
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
|
|
||||||
# Adding field 'FileInstance.path'
|
# Adding field 'Instance.path'
|
||||||
db.add_column('archive_fileinstance', 'path', self.gf('django.db.models.fields.CharField')(default='', max_length=2048), keep_default=False)
|
db.add_column('archive_fileinstance', 'path', self.gf('django.db.models.fields.CharField')(default='', max_length=2048), keep_default=False)
|
||||||
|
|
||||||
# Deleting field 'FileInstance.name'
|
# Deleting field 'Instance.name'
|
||||||
db.delete_column('archive_fileinstance', 'name')
|
db.delete_column('archive_fileinstance', 'name')
|
||||||
|
|
||||||
# Adding unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
# Adding unique constraint on 'Instance', fields ['volume', 'path', 'folder']
|
||||||
db.create_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
db.create_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
# Removing unique constraint on 'FileInstance', fields ['volume', 'folder', 'name']
|
# Removing unique constraint on 'Instance', fields ['volume', 'folder', 'name']
|
||||||
db.delete_unique('archive_fileinstance', ['volume_id', 'folder', 'name'])
|
db.delete_unique('archive_fileinstance', ['volume_id', 'folder', 'name'])
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Migration(SchemaMigration):
|
||||||
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1282476196'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1282476196'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1282476196'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1282476196'}),
|
||||||
|
|
|
@ -99,7 +99,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1282732467'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1282732467'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1282732467'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1282732467'}),
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1283966008'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1283966008'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1283966008'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1283966008'}),
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Migration(SchemaMigration):
|
||||||
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
},
|
},
|
||||||
'archive.fileinstance': {
|
'archive.fileinstance': {
|
||||||
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'Instance'},
|
||||||
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1285254686'}),
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1285254686'}),
|
||||||
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1285254686'}),
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1285254686'}),
|
||||||
|
|
|
@ -240,7 +240,7 @@ class Volume(models.Model):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s's %s"% (self.user, self.name)
|
return u"%s's %s"% (self.user, self.name)
|
||||||
|
|
||||||
class FileInstance(models.Model):
|
class Instance(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("name", "folder", "volume")
|
unique_together = ("name", "folder", "volume")
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ def api_update(request):
|
||||||
oshash = f['oshash']
|
oshash = f['oshash']
|
||||||
all_files.append(oshash)
|
all_files.append(oshash)
|
||||||
|
|
||||||
same_folder = models.FileInstance.objects.filter(folder=folder, volume=volume)
|
same_folder = models.Instance.objects.filter(folder=folder, volume=volume)
|
||||||
if same_folder.count() > 0:
|
if same_folder.count() > 0:
|
||||||
item = same_folder[0].file.item
|
item = same_folder[0].file.item
|
||||||
else:
|
else:
|
||||||
|
@ -95,7 +95,7 @@ def api_update(request):
|
||||||
|
|
||||||
path = os.path.join(folder, name)
|
path = os.path.join(folder, name)
|
||||||
|
|
||||||
instance = models.FileInstance.objects.filter(file__oshash=oshash, volume=volume)
|
instance = models.Instance.objects.filter(file__oshash=oshash, volume=volume)
|
||||||
if instance.count()>0:
|
if instance.count()>0:
|
||||||
instance = instance[0]
|
instance = instance[0]
|
||||||
updated = False
|
updated = False
|
||||||
|
@ -121,7 +121,7 @@ def api_update(request):
|
||||||
file_object.item = item
|
file_object.item = item
|
||||||
file_object.save()
|
file_object.save()
|
||||||
response['data']['info'].append(oshash)
|
response['data']['info'].append(oshash)
|
||||||
instance = models.FileInstance()
|
instance = models.Instance()
|
||||||
instance.volume = volume
|
instance.volume = volume
|
||||||
instance.file = file_object
|
instance.file = file_object
|
||||||
for key in ('mtime', 'name', 'folder'):
|
for key in ('mtime', 'name', 'folder'):
|
||||||
|
@ -130,7 +130,7 @@ def api_update(request):
|
||||||
|
|
||||||
#remove deleted files
|
#remove deleted files
|
||||||
#FIXME: can this have any bad consequences? i.e. on the selction of used item files.
|
#FIXME: can this have any bad consequences? i.e. on the selction of used item files.
|
||||||
models.FileInstance.objects.filter(volume=volume).exclude(file__oshash__in=all_files).delete()
|
models.Instance.objects.filter(volume=volume).exclude(file__oshash__in=all_files).delete()
|
||||||
|
|
||||||
user_profile = user.get_profile()
|
user_profile = user.get_profile()
|
||||||
user_profile.files_updated = datetime.now()
|
user_profile.files_updated = datetime.now()
|
||||||
|
@ -139,7 +139,7 @@ def api_update(request):
|
||||||
if 'info' in data:
|
if 'info' in data:
|
||||||
for oshash in data['info']:
|
for oshash in data['info']:
|
||||||
info = data['info'][oshash]
|
info = data['info'][oshash]
|
||||||
instance = models.FileInstance.objects.filter(file__oshash=oshash, volume__user=user)
|
instance = models.Instance.objects.filter(file__oshash=oshash, volume__user=user)
|
||||||
if instance.count()>0:
|
if instance.count()>0:
|
||||||
instance = instance[0]
|
instance = instance[0]
|
||||||
if not instance.file.info:
|
if not instance.file.info:
|
||||||
|
@ -149,7 +149,7 @@ def api_update(request):
|
||||||
instance.file.info = info
|
instance.file.info = info
|
||||||
instance.file.save()
|
instance.file.save()
|
||||||
|
|
||||||
files = models.FileInstance.objects.filter(volume__user=user, file__available=False)
|
files = models.Instance.objects.filter(volume__user=user, file__available=False)
|
||||||
if volume:
|
if volume:
|
||||||
files = files.filter(volume=volume)
|
files = files.filter(volume=volume)
|
||||||
response['data']['info'] = [f.file.oshash for f in files.filter(file__info='{}')]
|
response['data']['info'] = [f.file.oshash for f in files.filter(file__info='{}')]
|
||||||
|
|
Loading…
Reference in a new issue