from django.db import models
# Create your models here.classStudent(models.Model):
name = models.CharField(max_length=20)
sex = models.BooleanField()
classMeta:
db_table = 'stu'
app下views中的响应函数
from django.shortcuts import render,HttpResponse
from stu.models import Student
defaddstudent(request):
print(request)
stu = Student()
stu.name = 'GhostLinc'
stu.sex = 1
stu.save()
# 返回html文本return HttpResponse('insert success!')