formdata: use real formdata.id in get_json_export_dict() (#29587)

This commit is contained in:
Benjamin Dauvergne 2019-01-09 16:06:49 +01:00 committed by Frédéric Péters
parent f02f0d8df9
commit 41c263b717
3 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ Le contenu ainsi obtenu est le suivant :
<code mime="application/json">
{
"id": "newsletter/16",
"id": "16",
"receipt_time": "2013-01-04T13:39:47",
"last_update_time": "2013-01-04T13:41:21",
"fields": {

View File

@ -1639,7 +1639,7 @@ def test_api_anonymized_formdata(pub, local_user, admin_user):
assert not 'who' in resp.json[0]['evolution'][0]
assert 'time' in resp.json[0]['evolution'][0]
# check anonymise is enforced on detail view
resp = get_app(pub).get(sign_uri('/api/forms/%s/?anonymise&full=on' % resp.json[1]['id']))
resp = get_app(pub).get(sign_uri('/api/forms/test/%s/?anonymise&full=on' % resp.json[1]['id']))
assert 'receipt_time' in resp.json
assert 'fields' in resp.json
assert 'user' not in resp.json

View File

@ -944,7 +944,7 @@ class FormData(StorableObject):
def get_json_export_dict(self, include_files=True, anonymise=False):
data = {}
data['id'] = '%s/%s' % (self.formdef.url_name, self.id)
data['id'] = str(self.id)
data['display_id'] = self.get_display_id()
data['display_name'] = self.get_display_name()
data['receipt_time'] = self.receipt_time