From 3acd43f0d80045ed6f0162c8559932af02367a9b Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Mon, 5 Apr 2021 00:10:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8D=81=E5=9B=9B=E5=91=A8=20=E5=8D=81?= =?UTF-8?q?=E5=9B=9B=E5=91=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\272\214\350\212\202/models.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\272\214\350\212\202/models.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\272\214\350\212\202/models.py" new file mode 100644 index 00000000..dca237cf --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\272\214\350\212\202/models.py" @@ -0,0 +1,28 @@ +from django.db import models + +# Create your models here. + + +class Question(models.Model): + question_text = models.CharField(max_length=200) + pub_date = models.DateTimeField('date published') + + +class Choice(models.Model): + question = models.ForeignKey(Question, on_delete=models.CASCADE) + choice_text = models.CharField(max_length=200) + votes = models.IntegerField(default=0) + + +class Student(models.Model): + #db_colum 为数据库中的字段 + student_id = models.AutoField(primary_key=True, db_column="id") + name = models.CharField(max_length=200) + +class Book(models.Model): + book_id = models.AutoField(primary_key=True, db_column="id") + book_name = models.CharField(max_length=200) + +class BorrowRecord(Student, Book): + _id = models.AutoField(primary_key=True, db_column="id") + borrow_time = models.DateTimeField(auto_now_add=True) \ No newline at end of file -- Gitee From e4a5e4d9feed2b5d7c446f5532ebae4ffd65b23e Mon Sep 17 00:00:00 2001 From: doepy <8428487+doepy@user.noreply.gitee.com> Date: Mon, 5 Apr 2021 00:10:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=81=E5=9B=9B=E5=91=A8=20=E5=8D=81?= =?UTF-8?q?=E5=9B=9B=E5=91=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\270\211\350\212\202/models.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\270\211\350\212\202/models.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\270\211\350\212\202/models.py" new file mode 100644 index 00000000..fcc11634 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/3\347\217\255/3\347\217\255_\351\231\266\345\206\266/3\347\217\255---\351\231\266\345\206\266---\347\254\254\345\215\201\345\233\233\345\221\250\344\275\234\344\270\232 /\347\254\254\345\215\201\345\233\233\345\221\250_\347\254\254\344\270\211\350\212\202/models.py" @@ -0,0 +1,19 @@ +from django.db import models + +# Create your models here. + + +class Question(models.Model): + question_text = models.CharField(max_length=200) + pub_date = models.DateTimeField('date published') + + def __str__(self): + return f"id:{self.id}, {self.name}" + + +class Choice(models.Model): + question = models.ForeignKey(Question, on_delete=models.CASCADE) + choice_text = models.CharField(max_length=200) + votes = models.IntegerField(default=0) + + -- Gitee