forked from 0x2620/pandora
only include static annotations for anonymous users
This commit is contained in:
parent
aff011cf28
commit
8530fa6f66
2 changed files with 11 additions and 9 deletions
|
@ -80,7 +80,7 @@ class Annotation(models.Model):
|
||||||
public_id = models.CharField(max_length=128, unique=True, null=True)
|
public_id = models.CharField(max_length=128, unique=True, null=True)
|
||||||
#seconds
|
#seconds
|
||||||
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, db_index=True)
|
||||||
|
|
||||||
layer = models.CharField(max_length=255, db_index=True)
|
layer = models.CharField(max_length=255, db_index=True)
|
||||||
value = models.TextField()
|
value = models.TextField()
|
||||||
|
|
|
@ -1075,14 +1075,16 @@ def item(request, id):
|
||||||
data.append({'key': key.capitalize(), 'value': value})
|
data.append({'key': key.capitalize(), 'value': value})
|
||||||
clips = []
|
clips = []
|
||||||
clip = {'in': 0, 'annotations': []}
|
clip = {'in': 0, 'annotations': []}
|
||||||
for a in item.annotations.filter(
|
#logged in users should have javascript. not adding annotations makes load faster
|
||||||
layer__in=models.Annotation.public_layers()).order_by('start', 'end', 'sortvalue'):
|
if request.user.is_anonymous():
|
||||||
if clip['in'] < a.start:
|
for a in item.annotations.filter(
|
||||||
if clip['annotations']:
|
layer__in=models.Annotation.public_layers()).order_by('start', 'end', 'sortvalue'):
|
||||||
clip['annotations'] = '<br />\n'.join(clip['annotations'])
|
if clip['in'] < a.start:
|
||||||
clips.append(clip)
|
if clip['annotations']:
|
||||||
clip = {'in': a.start, 'annotations': []}
|
clip['annotations'] = '<br />\n'.join(clip['annotations'])
|
||||||
clip['annotations'].append(a.value)
|
clips.append(clip)
|
||||||
|
clip = {'in': a.start, 'annotations': []}
|
||||||
|
clip['annotations'].append(a.value)
|
||||||
ctx = {
|
ctx = {
|
||||||
'current_url': request.build_absolute_uri(request.get_full_path()),
|
'current_url': request.build_absolute_uri(request.get_full_path()),
|
||||||
'base_url': request.build_absolute_uri('/'),
|
'base_url': request.build_absolute_uri('/'),
|
||||||
|
|
Loading…
Reference in a new issue