質問編集履歴
1
情報の追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -31,4 +31,144 @@
|
|
31
31
|
|
32
32
|
現在は、解決策がよくわからない状態でいます。
|
33
33
|
助けていただけると嬉しいです。
|
34
|
-
よろしくお願いします。
|
34
|
+
よろしくお願いします。
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
ーーーーー追記ーーーーーー
|
39
|
+
エラーコードとurls.pyを追記します。アプリ名の部分は変更記述しています。
|
40
|
+
また、自身の中でOneToOneFieldに原因があるように思えてしまっていて、モデル同士の紐付けができていないのかなと考えています。
|
41
|
+
[この記事](https://narito.ninja/blog/detail/47/)にあるように何か記述が必要なのでしょうか?今回はソーシャル認証なのでどう参考になるかも曖昧なのですが…。
|
42
|
+
```
|
43
|
+
Environment:
|
44
|
+
|
45
|
+
Request Method: POST
|
46
|
+
Request URL: http://127.0.0.1:8000/create/
|
47
|
+
|
48
|
+
Django Version: 2.1.7
|
49
|
+
Python Version: 3.7.0
|
50
|
+
Installed Applications:
|
51
|
+
['django.contrib.admin',
|
52
|
+
'django.contrib.auth',
|
53
|
+
'django.contrib.contenttypes',
|
54
|
+
'django.contrib.sessions',
|
55
|
+
'django.contrib.messages',
|
56
|
+
'django.contrib.staticfiles',
|
57
|
+
'App.apps.AppConfig',
|
58
|
+
'social_django']
|
59
|
+
Installed Middleware:
|
60
|
+
['django.middleware.security.SecurityMiddleware',
|
61
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
62
|
+
'django.middleware.common.CommonMiddleware',
|
63
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
64
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
65
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
66
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware']
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
Traceback:
|
71
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute
|
72
|
+
85. return self.cursor.execute(sql, params)
|
73
|
+
|
74
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py" in execute
|
75
|
+
298. return Database.Cursor.execute(self, query, params)
|
76
|
+
|
77
|
+
The above exception (no such column: user_id) was the direct cause of the following exception:
|
78
|
+
|
79
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
|
80
|
+
34. response = get_response(request)
|
81
|
+
|
82
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
|
83
|
+
126. response = self.process_exception_by_middleware(e, request)
|
84
|
+
|
85
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
|
86
|
+
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
|
87
|
+
|
88
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/views/generic/base.py" in view
|
89
|
+
68. return self.dispatch(request, *args, **kwargs)
|
90
|
+
|
91
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/contrib/auth/mixins.py" in dispatch
|
92
|
+
52. return super().dispatch(request, *args, **kwargs)
|
93
|
+
|
94
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/views/generic/base.py" in dispatch
|
95
|
+
88. return handler(request, *args, **kwargs)
|
96
|
+
|
97
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/views/generic/edit.py" in post
|
98
|
+
172. return super().post(request, *args, **kwargs)
|
99
|
+
|
100
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/views/generic/edit.py" in post
|
101
|
+
142. return self.form_valid(form)
|
102
|
+
|
103
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/views/generic/edit.py" in form_valid
|
104
|
+
125. self.object = form.save()
|
105
|
+
|
106
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/forms/models.py" in save
|
107
|
+
458. self.instance.save()
|
108
|
+
|
109
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/base.py" in save
|
110
|
+
718. force_update=force_update, update_fields=update_fields)
|
111
|
+
|
112
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/base.py" in save_base
|
113
|
+
748. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
|
114
|
+
|
115
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/base.py" in _save_table
|
116
|
+
812. forced_update)
|
117
|
+
|
118
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/base.py" in _do_update
|
119
|
+
861. return filtered._update(values) > 0
|
120
|
+
|
121
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/query.py" in _update
|
122
|
+
712. return query.get_compiler(self.db).execute_sql(CURSOR)
|
123
|
+
|
124
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
|
125
|
+
1383. cursor = super().execute_sql(result_type)
|
126
|
+
|
127
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
|
128
|
+
1065. cursor.execute(sql, params)
|
129
|
+
|
130
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/utils.py" in execute
|
131
|
+
100. return super().execute(sql, params)
|
132
|
+
|
133
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/utils.py" in execute
|
134
|
+
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
|
135
|
+
|
136
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
|
137
|
+
77. return executor(sql, params, many, context)
|
138
|
+
|
139
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute
|
140
|
+
85. return self.cursor.execute(sql, params)
|
141
|
+
|
142
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/utils.py" in __exit__
|
143
|
+
89. raise dj_exc_value.with_traceback(traceback) from exc_value
|
144
|
+
|
145
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/utils.py" in _execute
|
146
|
+
85. return self.cursor.execute(sql, params)
|
147
|
+
|
148
|
+
File "/Users/username/PycharmProjects/project/venv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py" in execute
|
149
|
+
298. return Database.Cursor.execute(self, query, params)
|
150
|
+
|
151
|
+
Exception Type: OperationalError at /create/
|
152
|
+
Exception Value: no such column: user_id
|
153
|
+
```
|
154
|
+
以下にurls.py
|
155
|
+
```
|
156
|
+
from django.contrib import admin
|
157
|
+
from django.conf import settings
|
158
|
+
from django.conf.urls.static import static
|
159
|
+
from django.urls import include, path
|
160
|
+
from memo.views import IndexView, MemoDetailView, MemoCreateView, MemoUpdateView, MemoDeleteView
|
161
|
+
|
162
|
+
|
163
|
+
urlpatterns = [
|
164
|
+
path('', IndexView.as_view(), name="index"),
|
165
|
+
path('<uuid:pk>', MemoDetailView.as_view(), name="detail"),
|
166
|
+
path('<uuid:pk>/update', MemoUpdateView.as_view(), name="update"),
|
167
|
+
path('<uuid:pk>/delete', MemoDeleteView.as_view(), name="delete"),
|
168
|
+
|
169
|
+
path('create/', MemoCreateView.as_view(), name="create"),
|
170
|
+
path('admin/', admin.site.urls),
|
171
|
+
path('', include('social_django.urls', namespace='social'))
|
172
|
+
]
|
173
|
+
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
174
|
+
```
|