DRF序列化和反序列化(一:Serializer)
一:表关系如下 from django.db import models # Create your models here. __all__=['Book','Publisher','Authon'] class Book(models.Model): title =models.CharField(max_length=32,verbose_name='图书名称') CHOICES=((1,'python'),(2,'go'),(3,'linux')) category=models.IntegerField(choices=CHOICES,verbose_name='图书类别') pub_time=models.DateTimeField(verbose_name='出版日期') authon=models.ManyToManyField('Authon') publisher=models.ForeignKey(to='Publisher',on_delete=None) def __str__(self): return self.title class Authon(models.Model): name= models.CharField(max_length=32, verbose_name='作者姓名') def __str__(self): return