only include static annotations for anonymous users

This commit is contained in:
j 2012-02-19 09:11:18 +00:00
parent aff011cf28
commit 8530fa6f66
2 changed files with 11 additions and 9 deletions

View file

@ -80,7 +80,7 @@ class Annotation(models.Model):
public_id = models.CharField(max_length=128, unique=True, null=True)
#seconds
start = models.FloatField(default=-1, db_index=True)
end = models.FloatField(default=-1)
end = models.FloatField(default=-1, db_index=True)
layer = models.CharField(max_length=255, db_index=True)
value = models.TextField()

View file

@ -1075,6 +1075,8 @@ def item(request, id):
data.append({'key': key.capitalize(), 'value': value})
clips = []
clip = {'in': 0, 'annotations': []}
#logged in users should have javascript. not adding annotations makes load faster
if request.user.is_anonymous():
for a in item.annotations.filter(
layer__in=models.Annotation.public_layers()).order_by('start', 'end', 'sortvalue'):
if clip['in'] < a.start: