django ORM 简单示例简绍

简单 models 操作

1 class Host(models.Model):
2     nid = models.AutoField(primary_key=True)    #Nid为主键
3     hostname = models.CharField(max_length=32,db_index=True)  # db_index=true 表示创建索引
4     ip = models.IPAddressField(db_index=True)
5     port = models.IntegerField()
原文地址:https://www.cnblogs.com/liruixin/p/6431646.html