forked from 0x2620/pandora
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:
|
try:
|
||||||
entity = Entity.get(self.value)
|
entity = Entity.get(self.value)
|
||||||
j['entity'] = entity.json(user=user)
|
j['entity'] = entity.json(user=user)
|
||||||
j['value'] = entity.name
|
j['value'] = entity.html_link()
|
||||||
except:
|
except:
|
||||||
j['entity'] = {}
|
j['entity'] = {}
|
||||||
elif l['type'] == 'event':
|
elif l['type'] == 'event':
|
||||||
|
|
|
@ -283,8 +283,7 @@ def editAnnotation(request, data):
|
||||||
try:
|
try:
|
||||||
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
|
value = Entity.get_by_name(data['value'], layer['entity']).get_id()
|
||||||
except Entity.DoesNotExist:
|
except Entity.DoesNotExist:
|
||||||
response['data'] = a.json()
|
response = json_response({})
|
||||||
response['data']['editable'] = True
|
|
||||||
response['status']['text'] = 'unkown entity'
|
response['status']['text'] = 'unkown entity'
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -141,6 +141,8 @@ class Entity(models.Model):
|
||||||
response[key] = self.data[key]
|
response[key] = self.data[key]
|
||||||
return response
|
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):
|
def update_matches(self):
|
||||||
import annotation.models
|
import annotation.models
|
||||||
|
|
Loading…
Reference in a new issue