From c1feae1cdd0613b685a06d2a7b06e14af23a06d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 3 Oct 2011 16:41:52 +0200 Subject: [PATCH] add json view for deputies --- themis/datatypes/address.py | 12 ++++++++++++ themis/datatypes/configure.zcml | 8 ++++++++ themis/datatypes/views.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 themis/datatypes/views.py diff --git a/themis/datatypes/address.py b/themis/datatypes/address.py index db04999..7ce2cf1 100644 --- a/themis/datatypes/address.py +++ b/themis/datatypes/address.py @@ -34,6 +34,18 @@ class Address(Field): fax = None email = None + def as_dict(self): + return { + 'title': self.title, + 'street': self.street, + 'zipcode': self.zipcode, + 'city': self.city, + 'phone1': self.phone1, + 'phone2': self.phone2, + 'fax': self.fax, + 'email': self.email, + } + class IAddressWidget(IWidget): pass diff --git a/themis/datatypes/configure.zcml b/themis/datatypes/configure.zcml index 17a2a78..072f276 100644 --- a/themis/datatypes/configure.zcml +++ b/themis/datatypes/configure.zcml @@ -12,6 +12,14 @@ + + +