Flask を使ってweb app を作成しているのですが
AttributeError: 'NoneType' object has no attribute
というエラーが起きてしまいます
今までもFlaskは使っていてFormでつまずくことはなかったのでとても困っています。。。コードは下記です
html
1<form action="" method="post"> 2 {{ form.hidden_tag() }} 3 <p>{{ form.charity_name.label() }}<br> 4 {{ form.name(size=32) }}</p> 5 <p>{{ form.description.label }}<br> 6 {{ form.description() }}</p> 7 <p>{{ form.link.label }}<br> 8 {{ form.link() }}</p> 9 <p>{{ form.submit() }}</p> 10</form>
routing は以下のような感じです
python
1form = Form() 2 if form.is_submitted(): 3 print("submitted.") 4 if form.validate_on_submit(): 5 print('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA') 6 charity = Item.query.filter_by(user_id=current_user.id).first() 7 8 charity.name = form.charity_name.data 9 charity.description = form.description.data 10 charity.link = form.link.data 11 db.session.commit() 12
AttributeError: 'NoneType' object has no attribute 'name'
validate_on_submit()
はされているのですがこのエラーが出たのは初めてで困っております
原因や心当たりがある方がいればよろしくお願いします
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。