任何人都可以帮助我,我尝试在 python-django 上创建联系表单,当我尝试在数据库上进行迁移时,我收到错误“AttributeError:'ContactUs' 对象没有属性'模型'”模型.pyfrom django.db import modelsclass Form(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) date = models.DateTimeField() month = models.DateTimeField() year = models.DateTimeField() sender = models.EmailField() message = models.CharField() licence = models.CharField(max_length=100) zipCode = models.CharField(max_length=100) phoneNumber = models.CharField(max_length=100) cdlType = models.CharField(max_length=100)class ContactUs(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) sender = models.EmailField() message = models.CharField() phoneNumber = models.CharField(max_length=100)表格.pyfrom django import formsclass ContactForm(forms.Form): first_name = forms.CharField(max_length=100, required=True) last_name = forms.CharField(max_length=100, required=True) date = forms.DateTimeField(required=True) month = forms.DateTimeField(required=True) year = forms.DateTimeField(required=True) sender = forms.EmailField(required=True) message = forms.CharField(required=True) licence = forms.CharField(max_length=100, required=True) zipCode = forms.CharField(max_length=100, required=True) phoneNumber = forms.CharField(max_length=100, required=True) cdlType = forms.CharField(max_length=100, required=True)class ContactUs(forms.Form): first_name = forms.CharField(max_length=100, required=True) last_name = forms.CharField(max_length=100, required=True) sender = forms.EmailField(required=True) message = forms.CharField(required=True) phoneNumber = forms.CharField(max_length=100, required=True)一开始我制作了仅用于发送邮件的联系表格,但后来我修改了它,因为我需要在站点管理中显示数据。
添加回答
举报
0/150
提交
取消