ModelForm没有指定模型类。 (值错误)

时间:2019-08-21 09:04:15

标签: python django

from django import forms
from .models import Topic

class NewTopicForm(forms.ModelForm):
    message = forms.CharField(widget=forms.Textarea(), max_length=4000)

    class meta:
        model = Topic
        fields = ['subject', 'message']

1 个答案:

答案 0 :(得分:1)

Willem Van Onsem是正确的,应该是

class Meta:
    model = Topic