manager: fix duplicate cell view with unknown cell id (#63793)
gitea-wip/combo/pipeline/head There was a failure building this commit Details
gitea/combo/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Lauréline Guérin 2022-05-17 16:53:59 +02:00
parent 809862bc2d
commit 6e5eef1764
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 4 additions and 1 deletions

View File

@ -803,7 +803,7 @@ class PageDuplicateCellView(ManagedPageMixin, FormView):
def dispatch(self, request, *args, **kwargs):
try:
self.current_cell = CellBase.get_cell(kwargs['cell_reference'], page=kwargs['page_pk'])
except LinkListCell.DoesNotExist:
except ObjectDoesNotExist:
raise Http404
return super().dispatch(request, *args, **kwargs)

View File

@ -1490,6 +1490,9 @@ def test_duplicate_cell(app, admin_user):
assert PageSnapshot.objects.filter(page=page).count() == 1
assert PageSnapshot.objects.filter(page=other_page).count() == 2
app.get('/manage/pages/%s/cell/data_textcell-%s/duplicate' % (0, cell.pk), status=404)
app.get('/manage/pages/%s/cell/data_textcell-%s/duplicate' % (page.pk, 0), status=404)
def test_edit_cell_visibility(settings, app, admin_user):
settings.CELL_CONDITIONS_ENABLED = False