将值插入数据库中时出错

时间:2019-05-24 16:00:00

标签: django django-models django-rest-framework django-forms

当我尝试将值放入数据库时​​,出现此错误。

  

提高TypeError(“%s()获得了意外的关键字参数'%s'”%(cls。名称,kwarg))   TypeError:Employee()获得了意外的关键字参数'EmployeeID'

代码如下:

class Employee (models.Model):
    EmployeeID = models.IntegerField
    EmployeeFirstName = models.CharField(max_length=100)
    EmployeeLastName = models.CharField(max_length=100)
    EmployeeEmail = models.CharField(max_length=100)
    EmployeeMobileNumber = models.IntegerField
    EmployeeHireDate = models.DateField
    EmployeeType = models.CharField(max_length=50)

1 个答案:

答案 0 :(得分:1)

尝试放置EmployeeID = models.IntegerField()而不是EmployeeID = models.IntegerField