Commit 9a4be7a5 authored by Graziella Toutoungis's avatar Graziella Toutoungis
Browse files

add instant messenger address to person ( edit and view) and update the migration script

parent b8a5bb294179
if 'PostalAddress' in schema: if 'PostalAddress' in schema:
add_relation_definition('Person', 'postal_address', 'PostalAddress') add_relation_definition('Person', 'postal_address', 'PostalAddress')
if 'IMAddress' in schema:
add_relation_definition('Person', 'im_address', 'IMAddress')
...@@ -25,6 +25,8 @@ class Person(EntityType): ...@@ -25,6 +25,8 @@ class Person(EntityType):
phone = SubjectRelation('PhoneNumber', composite='subject') phone = SubjectRelation('PhoneNumber', composite='subject')
if 'PostalAddress' in defined_types: if 'PostalAddress' in defined_types:
postal_address = SubjectRelation('PostalAddress', composite='subject') postal_address = SubjectRelation('PostalAddress', composite='subject')
if 'IMAddress' in defined_types:
im_address = SubjectRelation('IMAddress', composite='subject')
use_email = SubjectRelation('EmailAddress', cardinality='*1', composite='subject') use_email = SubjectRelation('EmailAddress', cardinality='*1', composite='subject')
# allowing an email to be the primary email of multiple persons is necessary for # allowing an email to be the primary email of multiple persons is necessary for
......
...@@ -42,6 +42,14 @@ class PersonPrimaryView(primary.PrimaryView): ...@@ -42,6 +42,14 @@ class PersonPrimaryView(primary.PrimaryView):
(display_name(self.req, 'PostalAddress'), (display_name(self.req, 'PostalAddress'),
postaladdress.view('incontext')) ) postaladdress.view('incontext')) )
self.w(u"</table>") self.w(u"</table>")
if getattr(entity, 'im_address', None):
self.w(u"<table>")
for imaddress in entity.im_address:
self.w(u'<tr><th class="labelCol">%s</th><td>%s</td></tr>' %
(display_name(self.req, 'IMAddress'),
imaddress.view('incontext')) )
self.w(u"</table>")
super(PersonPrimaryView, self).render_entity_attributes(entity) super(PersonPrimaryView, self).render_entity_attributes(entity)
def summary(self, entity): def summary(self, entity):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment