Django ModelForm没有指定模型类。

23 浏览
0 Comments

Django ModelForm没有指定模型类。

我正在尝试使用ModelForm:

from django.db import models
from django.forms import ModelForm
class Car(models.Model):
    carnumber = models.CharField(max_length=5)
    def __unicode__(self):
        return self.carnumber
class PickForm(ModelForm):
    class Meta:
        Model = Car

我已经检查过了,但是找不到我的错误。当我在浏览器中调用视图时,会出现以下错误:

未指定模型类的ModelForm

我在相同的URL上测试了调用模型的视图,使用了简单的"foo bar"代码,但是当我尝试使用这段代码时,就会出现上述的类错误。

0