model:
class User(AbstractBaseUser, PermissionsMixin):
uuid = ShortUUIDField(unique=True)
username = models.CharField(max_length=100, db_index=True, unique=True, default='')
schoolid = models.CharField(max_length=100, null=True, blank=True, default='')
classid = models.CharField(max_length=100, null=True, blank=True, default='')
fullname = models.CharField(max_length=50, default='', null=True, blank=True)
email = models.EmailField(_('email address'), blank=True, null=True)
age = models.SmallIntegerField(default=0)
插入数据
User.objects.create(username='张三', schoolid=1, ...)
查询
User.objects.all() // 查出所有用户
User.objects.filter(classid = 1) // 查询班级为1的用户,返回一个对象列表
User.objects.filter(classid = 1) .first() // 查询班级为1的用户,返回第一个对象
修改
User.objects.filter(username = '张三') .update(classid =2) // 修改用户名为张三的用户,将其班级id改为2
删除
User.objects.filter(classid = 1).delete() //删除班级为1的所有用户