-1
はforms.ModelFormにウィジェットを割り当てるときに、私は次のエラーを取得しています
ウィジェット。 このエラーを修正する方法を提案してください。
from django import forms
from django.forms import ModelForm, CharField
from .models import *
class CreateTaskMaster(forms.ModelForm):
class Meta():
model = TaskMaster
fields = ["sid", "tasktype", "task_title", "task_description",
"datacenter", "priority", "sourceincident", "processingteam",
"duedate"]
widgets = {
'duedate': CharField(widget=forms.TextInput(attrs={'class': 'form-
control mr-sm-2'})),
}
forms.py Model.pyが
Class TaskMaster(models.Model):
sid = models.CharField(max_length=3)
processor = models.ForeignKey(User,null=True)
tasktype = models.ForeignKey(TaskTypeTable, null=True)
task_title = models.TextField(null=True)
task_description = models.TextField(null=True)
datacenter = models.ForeignKey(DatacenterTable,null=True)
priority = models.ForeignKey(PriorityTable, null=True)
status = models.ForeignKey(StatusTable,default=1, null=True)
pid = models.IntegerField(null=True)
sourceincident = models.URLField(null=True)
errorincident = models.URLField(null=True)
processingteam = models.ForeignKey(TeamTable, null=True)
createddate = models.DateField(("Date"), default=datetime.date.today)
duedate = models.DateField(("Date"), default=datetime.date.today)
istaskactive = models.BooleanField(default=True)
class Meta:
ordering = ('duedate',)
あなたはエラーを掲載しているようには見えません。 –