这是错误
TypeError:调用元类基类元类冲突时出错:派生类的元类必须是其所有基类的元类的(非严格)子类
我的models.py中有问题的类
class Business(models.Model, forms.Form):
name = models.CharField(max_length=128)
tel_no = models.CharField(max_length=11)
address_ln1 = models.CharField(max_length=128)
address_ln2 = models.CharField(max_length=128)
city = models.CharField(max_length=64)
county = GBCountySelect()
postcode = GBPostcodeField()
website = models.URLField(max_length=128)
# Logging Info
slug = models.SlugField()
date_added = models.DateField(auto_now_add=True)
time_added = models.TimeField()
added_by_user = models.CharField(max_length=64)
last_edit_time = models.TimeField(auto_now=True)
last_edit_date = models.DateField(auto_now=True)
Run Code Online (Sandbox Code Playgroud)
我收到错误的行:
name = models.CharField(max_length=128)
Run Code Online (Sandbox Code Playgroud)
但我(想)这意味着这个:
class Business(models.Model, forms.Form):
Run Code Online (Sandbox Code Playgroud)
我不确定它究竟是什么意思,我如何从models.Model和forms.Form继承我的模型在同一个类中?在创建课程时,我不能传递两个值吗?如果是这样的话?
另一个编辑
All my imports
from django.db import models
from django import forms
from django.contrib.localflavor import generic
from django.contrib.localflavor.gb.forms import GBPostcodeField, …Run Code Online (Sandbox Code Playgroud)