misc: do not export cached_ attributes (#12879)

This commit is contained in:
Frédéric Péters 2017-01-03 18:18:55 +01:00
parent e904a918f0
commit ccab10c45f
2 changed files with 6 additions and 0 deletions

View File

@ -213,6 +213,9 @@ class Page(models.Model):
for cell in serialized_page['cells']:
del cell['pk']
del cell['fields']['page']
for key in cell['fields'].keys():
if key.startswith('cached_'):
del cell['fields'][key]
return serialized_page
@classmethod

View File

@ -1,5 +1,6 @@
import pytest
import json
import re
import requests
import subprocess
@ -226,6 +227,8 @@ def test_form_cell_save_cache():
cell.save()
assert cell.cached_title == 'form title'
assert cell.get_additional_label() == 'form title'
# make sure cached attributes are removed from serialized pages
assert not 'cached_' in json.dumps(page.get_serialized_page())
@wcsctl_present
def test_category_cell_save_cache():