AttributeError at xxxx

django Exception Published at Feb. 15, 2025, 3:15 a.m. by admin@senrigan.org

Formオブジェクトにget()がない?うーんなんだろうと思ったけど、super().__init__()にself渡す必要ないんだっけ?

AttributeError at /inquiry/
'InquiryForm' object has no attribute 'get'
Request Method: GET
Request URL:    http://127.0.0.1:8000/inquiry/
Django Version: 5.1.6
Exception Type: AttributeError
Exception Value:    
'InquiryForm' object has no attribute 'get'
Exception Location: /workspace/diary/.venv/lib/python3.12/site-packages/django/forms/widgets.py, line 295, in value_from_datadict
Raised during:  diary.views.InquiryView

原因

super呼ぶときに()init()にself渡してた。

    def __init__(self, *args, **kwargs):
        super().__init__(self, *args, **kwargs)