質問編集履歴

1

追記

2019/03/22 09:18

投稿

chamhog
chamhog

スコア44

test CHANGED
File without changes
test CHANGED
@@ -1 +1,31 @@
1
1
  Dojagoのmodels.pyでクラスを作成する時の引数の中身をmodel.Modelにする理由がよくわかりません。初歩的ですがお願いします。
2
+
3
+ 追記ー 公式ドキュメントの例です。
4
+
5
+ ```python
6
+
7
+ from django.db import models
8
+
9
+
10
+
11
+
12
+
13
+ class Question(models.Model):
14
+
15
+ question_text = models.CharField(max_length=200)
16
+
17
+ pub_date = models.DateTimeField('date published')
18
+
19
+
20
+
21
+
22
+
23
+ class Choice(models.Model):
24
+
25
+ question = models.ForeignKey(Question, on_delete=models.CASCADE)
26
+
27
+ choice_text = models.CharField(max_length=200)
28
+
29
+ votes = models.IntegerField(default=0)
30
+
31
+ ```