applications: card cell dependencies to pages (#86520)
This commit is contained in:
parent
f74e768a11
commit
81b27151a3
|
@ -1096,6 +1096,11 @@ class WcsCardCell(CardMixin, CellBase):
|
|||
if not value:
|
||||
continue
|
||||
yield from get_wcs_dependencies_from_template(str(value))
|
||||
if cell.get('page') not in ['', None]:
|
||||
try:
|
||||
yield Page.objects.get(pk=cell['page'])
|
||||
except Page.DoesNotExist:
|
||||
pass
|
||||
|
||||
def check_validity(self):
|
||||
if self.get_related_card_path():
|
||||
|
|
|
@ -661,6 +661,14 @@ def test_page_dependencies_card_cell(mock_send):
|
|||
cell.mark_as_invalid(reason_code='foobar')
|
||||
assert card_dep not in page.get_dependencies()
|
||||
|
||||
other_page = Page.objects.create(title='Other Test', slug='other-test', template_name='standard')
|
||||
cell.mark_as_valid()
|
||||
cell.custom_schema = {'cells': [{'page': other_page.pk}]}
|
||||
cell.save()
|
||||
assert other_page in page.get_dependencies()
|
||||
cell.mark_as_invalid(reason_code='foobar')
|
||||
assert other_page not in page.get_dependencies()
|
||||
|
||||
|
||||
@mock.patch('requests.Session.send', side_effect=mocked_requests_send)
|
||||
def test_page_dependencies_category_cell(mock_send):
|
||||
|
|
Loading…
Reference in New Issue