return html value for entities
This commit is contained in:
parent
d492619be6
commit
ad8db3a293
3 changed files with 4 additions and 3 deletions
|
@ -228,7 +228,7 @@ class Annotation(models.Model):
|
|||
try:
|
||||
entity = Entity.get(self.value)
|
||||
j['entity'] = entity.json(user=user)
|
||||
j['value'] = entity.name
|
||||
j['value'] = entity.html_link()
|
||||
except:
|
||||
j['entity'] = {}
|
||||
elif l['type'] == 'event':
|
||||
|
|
|
@ -283,8 +283,7 @@ def editAnnotation(request, data):
|
|||
try:
|
||||
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
|
||||
except Entity.DoesNotExist:
|
||||
response['data'] = a.json()
|
||||
response['data']['editable'] = True
|
||||
response = json_response({})
|
||||
response['status']['text'] = 'unkown entity'
|
||||
return render_to_json_response(response)
|
||||
else:
|
||||
|
|
|
@ -141,6 +141,8 @@ class Entity(models.Model):
|
|||
response[key] = self.data[key]
|
||||
return response
|
||||
|
||||
def html_link(self):
|
||||
return '<a href="/entities/%s">%s</a>' % (self.get_id(), ox.escape_html(self.name))
|
||||
|
||||
def update_matches(self):
|
||||
import annotation.models
|
||||
|
|
Loading…
Reference in a new issue