annotations/icons/list description

This commit is contained in:
j 2011-01-18 15:24:14 +05:30
parent b43ea828d9
commit b1924e3c47
4 changed files with 24 additions and 13 deletions

View file

@ -13,20 +13,23 @@ class Layer(models.Model):
class Meta:
ordering = ('position', )
enabled = models.BooleanField(default=True)
name = models.CharField(null=True, max_length=255, unique=True)
title = models.CharField(null=True, max_length=255)
#text, string, string from list(fixme), event, place, person
#text, string, string from list(fixme), date, place, person, pingback,
#What about: smart layers? for date, place, person
type = models.CharField(null=True, max_length=255)
#can this be changed per user?
position = models.IntegerField(default=0)
overlapping = models.BooleanField(default=True)
enabled = models.BooleanField(default=True)
enabled = models.BooleanField(default=True)
overlap = models.BooleanField(default=True)
overlay = models.BooleanField(default=True)
public = models.BooleanField(default=True) #false=users only see there own bins
subtitle = models.BooleanField(default=True) #bis can be displayed as subtitle, only one bin
find = models.BooleanField(default=True)
#find/sort integration
find = models.BooleanField(default=True) #true part of find all
#words / item duration(wpm), total words, cuts per minute, cuts, number of annotations, number of annotations/duration
sort = models.CharField(null=True, max_length=255)
@ -55,7 +58,7 @@ class Annotation(models.Model):
#seconds
start = models.FloatField(default=-1)
stop = models.FloatField(default=-1)
end = models.FloatField(default=-1)
layer = models.ForeignKey(Layer)
value = models.TextField()
@ -74,16 +77,19 @@ class Annotation(models.Model):
else:
return self.value
def get_id(self):
return ox.to32(self.id)
def json(self):
return {
'id': self.id,
'id': self.get_id(),
'user': self.user.username,
'start': self.start,
'stop': self.start,
'end': self.end,
'value': self.value,
'value_html': self.html(),
'layer': self.layer.name
}
def __unicode__(self):
return "%s/%s-%s" %(self.item, self.start, self.stop)
return u"%s/%s-%s" %(self.item, self.start, self.end)

View file

@ -10,7 +10,7 @@ import models
from api.actions import actions
def findAnnotation(request):
def findAnnotations(request):
'''
param data {
fixme
@ -29,7 +29,7 @@ def findAnnotation(request):
qs = models.Annotations.objects.filter(item__itemId=data['item'])
response['data']['annotations'] = [a.json() for a in qs]
return render_to_json_response(response)
actions.register(findAnnotation)
actions.register(findAnnotations)
@login_required_json

View file

@ -652,6 +652,7 @@ class Item(models.Model):
stream.extract_derivatives()
self.make_local_posters()
self.make_poster()
self.make_icon()
self.available = True
self.save()

View file

@ -215,6 +215,8 @@ def addList(request):
if not request.user.is_staff and value == 'featured':
value = 'private'
setattr(list, key, value)
elif key == 'description':
list.description = data['description']
list.save()
if list.status == 'featured':
@ -313,6 +315,8 @@ def editList(request):
num += 1
name = data['name'] + ' (%d)' % num
list.name = name
elif key == 'description':
list.description = data['description']
if 'position' in data:
pos, created = models.Position.objects.get_or_create(list=list, user=request.user)