好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Django的Model操作

增:

删:

改:
ip = models.GenericIPAddressField(protocol="ipv4",null=True,blank=True)
img = models.ImageField(null=True,blank=True,upload_to="upload") 
 1 from django.db import models 2  3  4 # Create your models here. 5 class UserType(models.Model): 6     name = models.CharField(max_length=50)    
 7 class UserInfo(models.Model): 8     username = models.CharField(max_length=50) 9     password = models.CharField(max_length=50)10     email = models.EmailField()11     user_type = models.ForeignKey('UserType') 
 1 from django.db import models 2  3  4 # Create your models here. 5 class UserType(models.Model): 6     name = models.CharField(max_length=50)    
 7 class UserInfo(models.Model): 8     username = models.CharField(max_length=50) 9     password = models.CharField(max_length=50)10     email = models.EmailField()11     user_type = models.ForeignKey('UserType')    
12 class UserGroup(models.Model):13     GroupName = models.CharField(max_length=50)14     user = models.ManyToManyField("UserInfo") 
 1 from django.db import models 2  3  4 # Create your models here. 5 class UserType(models.Model): 6     name = models.CharField(max_length=50)    
 7 class UserInfo(models.Model): 8     username = models.CharField(max_length=50) 9     password = models.CharField(max_length=50)10     email = models.EmailField()11     user_type = models.ForeignKey('UserType')    
12 class UserGroup(models.Model):13     GroupName = models.CharField(max_length=50)14     user = models.ManyToManyField("UserInfo")    
15 class Admin(models.Model):16     Address = models.CharField()17     user_info_address = models.OneToOneField('UserInfo') 

以上就是Django的Model操作的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于Django的Model操作的详细内容...

  阅读:37次