質問編集履歴
1
補足
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
djangoの
|
1
|
+
djangoのモデル作成で発生したエラーを解決したい(timestamp)
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
djangoのモデルを作成して、
|
1
|
+
djangoのモデルを作成して、管理サイトで予定を追加しようとすると以下のエラーが出ます。models.pyのscheduleTimeを消去して実行するとうまくいきます。タイムスタンプ?か何かが原因に思うのですが、調べてもよくわかりません。よろしくお願いします。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -6,9 +6,31 @@
|
|
6
6
|
|
7
7
|
```python
|
8
8
|
|
9
|
-
|
9
|
+
psycopg2.errors.DatatypeMismatch: column "scheduleTime" is of type integer but expression is of type timestamp with time zone
|
10
10
|
|
11
|
-
LINE 1: ...
|
11
|
+
LINE 1: ... "schedule", "scheduleTime") VALUES (1, 'お花見', '2021-09-1...
|
12
|
+
|
13
|
+
^
|
14
|
+
|
15
|
+
HINT: You will need to rewrite or cast the expression.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
The above exception was the direct cause of the following exception:
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
django.db.utils.ProgrammingError: column "scheduleTime" is of type integer but expression is of type timestamp with time zone
|
26
|
+
|
27
|
+
LINE 1: ... "schedule", "scheduleTime") VALUES (1, 'お花見', '2021-09-1...
|
28
|
+
|
29
|
+
^
|
30
|
+
|
31
|
+
HINT: You will need to rewrite or cast the expression.
|
32
|
+
|
33
|
+
|
12
34
|
|
13
35
|
```
|
14
36
|
|
@@ -24,13 +46,13 @@
|
|
24
46
|
|
25
47
|
|
26
48
|
|
27
|
-
# Create your models here.
|
28
|
-
|
29
49
|
class Calender(models.Model):
|
30
50
|
|
31
51
|
user = models.ForeignKey(CustomUser, verbose_name="ユーザー", on_delete=models.PROTECT)
|
32
52
|
|
33
53
|
schedule = models.CharField(verbose_name="予定", max_length=30, null=True, blank=True)
|
54
|
+
|
55
|
+
#scheduleTime = models.DateTimeField(verbose_name="日にち", auto_now=True)
|
34
56
|
|
35
57
|
|
36
58
|
|