我的代码如下所示:
let employeeNames = ["Donkey", "Horse", "Zebra","Okapi"]
for i in 0..<employeeNames.count
{
let employeeEntry = NSEntityDescription.insertNewObjectForEntityForName("ZooAnimals", inManagedObjectContext: managedObject)
employeeEntry.setValue(employeeNames[i], forKey: "employeename")
employees.setValue(index, forKey: "animal")
do {
try managedObject.save()
} catch {
print("problem saving")
}
}
通过这段代码,我试图在mysql中创建class CharMaxlength25Field(models.Field):
def db_type(self, connection):
return 'enum(android,ios)'
class search(models.Model):
class Meta:
db_table = 'search'
city_name = CharMaxlength25Field()
字段。现在,当我尝试使用enum
步骤运行此架构时,出现以下错误:
python manage.py makemigrations
答案 0 :(得分:1)
尝试添加引号:
class CharMaxlength25Field(models.Field):
def db_type(self, connection):
return 'enum("android","ios")'