make sequence ids same as clip ids
This commit is contained in:
parent
ca93e35c00
commit
e21484af1c
2 changed files with 9 additions and 4 deletions
|
@ -18,12 +18,15 @@ from changelog.models import Changelog
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class Sequence(models.Model):
|
class Sequence(models.Model):
|
||||||
public_id = models.CharField(max_length=128, unique=True)
|
class Meta:
|
||||||
|
unique_together = ("public_id", "mode")
|
||||||
|
|
||||||
|
mode = models.CharField(max_length=128)
|
||||||
|
public_id = models.CharField(max_length=128)
|
||||||
item = models.ForeignKey(Item, null=True, related_name='sequences')
|
item = models.ForeignKey(Item, null=True, related_name='sequences')
|
||||||
sort = models.ForeignKey(ItemSort, null=True, related_name='sequences')
|
sort = models.ForeignKey(ItemSort, null=True, related_name='sequences')
|
||||||
user = models.IntegerField(db_index=True, null=True)
|
user = models.IntegerField(db_index=True, null=True)
|
||||||
|
|
||||||
mode = models.CharField(max_length=255)
|
|
||||||
hash = models.CharField(db_index=True, max_length=16, default='')
|
hash = models.CharField(db_index=True, max_length=16, default='')
|
||||||
start = models.FloatField(default=-1, db_index=True)
|
start = models.FloatField(default=-1, db_index=True)
|
||||||
end = models.FloatField(default=-1)
|
end = models.FloatField(default=-1)
|
||||||
|
@ -31,8 +34,8 @@ class Sequence(models.Model):
|
||||||
objects = managers.SequenceManager()
|
objects = managers.SequenceManager()
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
self.public_id = u"%s/%s/%s-%s" % (
|
self.public_id = u"%s/%s-%s" % (
|
||||||
self.item.itemId, self.mode, float(self.start), float(self.end)
|
self.item.itemId, float(self.start), float(self.end)
|
||||||
)
|
)
|
||||||
if self.item:
|
if self.item:
|
||||||
self.user = self.item.user and self.item.user.id
|
self.user = self.item.user and self.item.user.id
|
||||||
|
|
|
@ -55,6 +55,8 @@ def findSequences(request):
|
||||||
itemsQuery: ...
|
itemsQuery: ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
one of your conditions has to be key: 'mode', value: [shape,color], operator: '=='
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'status': {'code': int, 'text': string}
|
'status': {'code': int, 'text': string}
|
||||||
'data': {
|
'data': {
|
||||||
|
|
Loading…
Reference in a new issue