annotation ids

This commit is contained in:
j 2011-10-29 16:12:28 +02:00
parent 826e61a2eb
commit fd39f122ad
2 changed files with 7 additions and 4 deletions

View file

@ -109,12 +109,13 @@ class Annotation(models.Model):
return self.value
def set_public_id(self):
if self.id:
public_id = Annotation.objects.filter(item=self.item, id__lt=self.id).count()
self.public_id = "%s/%s" % (self.item.itemId, ox.to26(public_id))
Annotation.objects.filter(id=self.id).update(public_id=self.public_id)
def save(self, *args, **kwargs):
set_public_id = not self.id
set_public_id = not self.id or not self.public_id
#no clip or update clip
if not self.clip and not self.layer.private or \

View file

@ -340,6 +340,8 @@ class Item(models.Model):
#FIXME: should this really happen for annotations?
for a in self.annotations.all():
a.item = other
a.public_id = None
a.save()
if hasattr(self, 'files'):
for f in self.files.all():