Django ModelForm has no model class specified

后端 未结 9 472
误落风尘
误落风尘 2021-02-02 08:36

I am trying to use ModelForm:

from django.db import models
from django.forms import ModelForm

class Car(models.Model):
    carnumber = models.CharField(max_leng         


        
9条回答
  •  面向向阳花
    2021-02-02 09:20

    It should be model instead of Model (and without the trailing `, but I guess that's a typo):

    class PickForm(ModelForm):
        class Meta:
            model = Car
    

提交回复
热议问题