data: don't build the cache on cell update (#51472)

This commit is contained in:
Lauréline Guérin 2021-02-26 15:52:52 +01:00
parent bf3cb40c5c
commit 95a466f1c7
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 6 additions and 2 deletions

View File

@ -2014,4 +2014,8 @@ def cell_maintain_page_cell_cache(sender, instance=None, **kwargs):
if not instance.page_id:
return
page = instance.page
if kwargs.get('created') is False:
# don't build the cache on update, but update page's last_update_timestamp
page.save(update_fields=['last_update_timestamp'])
return
page.build_cell_cache()

View File

@ -832,7 +832,7 @@ def test_site_export_import_json(app, admin_user):
resp.form['site_file'] = Upload('site-export.json', site_export, 'application/json')
with CaptureQueriesContext(connection) as ctx:
resp = resp.form.submit()
assert len(ctx.captured_queries) in [1140, 1141]
assert len(ctx.captured_queries) in [853, 854]
Page.objects.all().delete()
assert LinkCell.objects.count() == 0
@ -841,7 +841,7 @@ def test_site_export_import_json(app, admin_user):
resp.form['site_file'] = Upload('site-export.json', site_export, 'application/json')
with CaptureQueriesContext(connection) as ctx:
resp = resp.form.submit()
assert len(ctx.captured_queries) == 665
assert len(ctx.captured_queries) == 378
assert set(Page.objects.get(slug='one').related_cells['cell_types']) == set(
['data_textcell', 'data_linkcell']
)