coderedcorp / coderedcorp/coderedcms

Form submissions return 404 with Wagtail 7.x due to FormMixin isinstance check

オープン
#710 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
765
フォーク
154
PR マージ指標
30日以内にマージされた PR はありません

説明

As @vsalvino and the team know, I am not a programmer and tend to find my way by trial and error (mostly error). So, like many people lately, I've been using Claude Code to assist with web development. The error description below was created by Claude in response to an error I am seeing. I apologize if it's inappropriate to post an issue generated by an LLM (it does look like a pretty good issue description, though...).

## Description

Form submissions are inaccessible in the Wagtail admin (404 error) when using CodeRed CMS 6.0 with Wagtail 7.x. The Forms listing page shows forms correctly, but clicking to view submissions returns a 404.

## Steps to Reproduce

1. Install CodeRed CMS 6.0.0 with Wagtail 7.1.x
2. Create a FormPage with some form fields
3. Submit the form a few times to create submissions
4. Go to Wagtail admin → Forms
5. Click on the form page to view submissions
6. **Result**: 404 error at `/admin/forms/submissions//`

## Root Cause

In May 2025, Wagtail added an `isinstance` check in [`wagtail/contrib/forms/views.py`](https://github.com/wagtail/wagtail/blob/main/wagtail/contrib/forms/views.py#L37) (commit [efd5d49](https://github.com/wagtail/wagtail/commit/efd5d49438d90df5c73981983e873d31873edbde)):

```python
def get_submissions_list_view(request, *args, **kwargs):
page_id = kwargs.get("page_id")
form_page = get_object_or_404(Page, id=page_id).specific
if not isinstance(form_page, FormMixin):
raise Http404 # <-- This causes the 404
return form_page.serve_submissions_list_view(request, *args, **kwargs)
```

The problem is that `CoderedFormMixin` does **not** inherit from `wagtail.contrib.forms.models.FormMixin`:

```python
>>> from wagtail.contrib.forms.models import FormMixin
>>> from coderedcms.models import CoderedFormPage, CoderedFormMixin
>>> issubclass(CoderedFormPage, FormMixin)
False
>>> issubclass(CoderedFormMixin, FormMixin)
False
```

## Suggested Fix

`CoderedFormMixin` should inherit from `wagtail.contrib.forms.models.FormMixin` to pass the isinstance check. This may require reconciling any method/attribute conflicts between the two mixins.

Alternatively, CodeRed CMS could register its own URL route for form submissions that bypasses Wagtail's check.

## Environment

- **CodeRed CMS**: 6.0.0
- **Wagtail**: 7.1.1
- **Python**: 3.14
- **Django**: 5.1.x

## Related

This likely also affects `wagtail-flexible-forms` since `StreamFormMixin` similarly does not inherit from Wagtail's `FormMixin`.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

coderedcms.models から始め、wagtail/contrib/forms/views.py と併せて CoderedFormMixin を調査します。特に get_submissions_list_view と Wagtail の FormMixin check を確認してください。既存のフォーム動作を壊さずに mixin を整合させ、その後、Wagtail 7.x 上の CodeRed フォームで管理画面の submissions URL が 404 を返さなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
django, python
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。