api: export last_update_time in formdata json (#6640)

This commit is contained in:
Thomas NOËL 2015-03-24 15:31:15 +01:00
parent b6ccb50c2a
commit 76c62bd425
2 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,7 @@ Le contenu ainsi obtenu est le suivant :
{
"id": "newsletter/16",
"receipt_time": "2013-01-04T13:39:47",
"last_update_time": "2013-01-04T13:41:21",
"fields": {
"email": "marc@example.net",
"nom": "L.",

View File

@ -480,6 +480,14 @@ class FormData(StorableObject):
concerned_roles = property(get_concerned_roles)
def get_last_update_time(self):
if self.evolution and self.evolution[-1].time:
return self.evolution[-1].time
else:
return self.receipt_time
last_update_time = property(get_last_update_time)
def anonymise(self):
for field in self.formdef.fields:
if field.anonymise:
@ -510,6 +518,7 @@ class FormData(StorableObject):
'name': self.formdef.name,
'id': data['display_id']}
data['receipt_time'] = self.receipt_time
data['last_update_time'] = self.last_update_time
data['url'] = self.get_url()
try: