質問編集履歴

3

2021/09/02 05:44

投稿

yayaya22
yayaya22

スコア51

test CHANGED
File without changes
test CHANGED
@@ -282,7 +282,7 @@
282
282
 
283
283
  <td>{{ Post_Detail.name }}</td>
284
284
 
285
- <td>{{ Post_Detail.likecount }}</td>
285
+ <td>{{ Post_Detail.like }}</td>
286
286
 
287
287
  </td>
288
288
 

2

2021/09/02 05:44

投稿

yayaya22
yayaya22

スコア51

test CHANGED
File without changes
test CHANGED
@@ -16,122 +16,122 @@
16
16
 
17
17
  ```
18
18
 
19
+ forms.py
20
+
21
+
22
+
23
+ from django import forms
24
+
25
+ from .models import Post_Detail
26
+
27
+
28
+
29
+ class UserForm(forms.ModelForm):
30
+
31
+ class Meta:
32
+
33
+ model = Post_Detail
34
+
35
+ fields = ['name','like']
36
+
37
+
38
+
39
+ ```
40
+
41
+
42
+
43
+ ```ここに言語を入力
44
+
19
45
  models.py
20
46
 
21
47
 
22
48
 
49
+ from django.contrib.auth.models import User
50
+
23
- from django import forms
51
+ from django.db import models
52
+
53
+ from django.utils import timezone
54
+
55
+ from django.contrib.auth import get_user_model
56
+
57
+
58
+
59
+ class Post_Detail(models.Model):
60
+
61
+ name = models.CharField('名前', max_length=100)
62
+
63
+ like = models.CharField('好きなもの', max_length=100)
64
+
65
+ regist_date = models.DateTimeField(default=timezone.now)
66
+
67
+ author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
68
+
69
+
70
+
71
+ def __str__(self):
72
+
73
+ return self.author.username
74
+
75
+
76
+
77
+ ```
78
+
79
+
80
+
81
+ ```ここに言語を入力
82
+
83
+ urls.py
84
+
85
+
86
+
87
+ from django.urls import path
88
+
89
+ from . import views
90
+
91
+
92
+
93
+ urlpatterns = [
94
+
95
+ path('', views.home, name='home'),
96
+
97
+ path('users/<int:user_id>/', views.MyPage, name='mypage'),
98
+
99
+ path('users/<int:user_id>/create/', views.create, name='create'),
100
+
101
+ path('users/<int:user_id>/edit/', views.UsersEdit, name='edit'),
102
+
103
+
104
+
105
+ ]
106
+
107
+
108
+
109
+ ```
110
+
111
+
112
+
113
+ ```ここに言語を入力
114
+
115
+ views.py
116
+
117
+
118
+
119
+ from django.contrib import auth
120
+
121
+ from django.conf import settings
122
+
123
+ from django.contrib.auth.decorators import login_required
124
+
125
+ from django.contrib.auth.models import User
126
+
127
+ from django.shortcuts import render, redirect,get_object_or_404
128
+
129
+ from .forms import UserForm,UserEditForm
24
130
 
25
131
  from .models import Post_Detail
26
132
 
27
133
 
28
134
 
29
- class UserForm(forms.ModelForm):
30
-
31
- class Meta:
32
-
33
- model = Post_Detail
34
-
35
- fields = ['name','like']
36
-
37
-
38
-
39
- ```
40
-
41
-
42
-
43
- ```ここに言語を入力
44
-
45
- models.py
46
-
47
-
48
-
49
- from django.contrib.auth.models import User
50
-
51
- from django.db import models
52
-
53
- from django.utils import timezone
54
-
55
- from django.contrib.auth import get_user_model
56
-
57
-
58
-
59
- class Post_Detail(models.Model):
60
-
61
- name = models.CharField('名前', max_length=100)
62
-
63
- like = models.CharField('好きなもの', max_length=100)
64
-
65
- regist_date = models.DateTimeField(default=timezone.now)
66
-
67
- author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
68
-
69
-
70
-
71
- def __str__(self):
72
-
73
- return self.author.username
74
-
75
-
76
-
77
- ```
78
-
79
-
80
-
81
- ```ここに言語を入力
82
-
83
- urls.py
84
-
85
-
86
-
87
- from django.urls import path
88
-
89
- from . import views
90
-
91
-
92
-
93
- urlpatterns = [
94
-
95
- path('', views.home, name='home'),
96
-
97
- path('users/<int:user_id>/', views.MyPage, name='mypage'),
98
-
99
- path('users/<int:user_id>/create/', views.create, name='create'),
100
-
101
- path('users/<int:user_id>/edit/', views.UsersEdit, name='edit'),
102
-
103
-
104
-
105
- ]
106
-
107
-
108
-
109
- ```
110
-
111
-
112
-
113
- ```ここに言語を入力
114
-
115
- views.py
116
-
117
-
118
-
119
- from django.contrib import auth
120
-
121
- from django.conf import settings
122
-
123
- from django.contrib.auth.decorators import login_required
124
-
125
- from django.contrib.auth.models import User
126
-
127
- from django.shortcuts import render, redirect,get_object_or_404
128
-
129
- from .forms import UserForm,UserEditForm
130
-
131
- from .models import Post_Detail
132
-
133
-
134
-
135
135
 
136
136
 
137
137
  @login_required

1

文の修正

2021/09/02 05:43

投稿

yayaya22
yayaya22

スコア51

test CHANGED
File without changes
test CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  name = models.CharField('名前', max_length=100)
62
62
 
63
- like = models.IntegerField('好きなもの', max_length=100)
63
+ like = models.CharField('好きなもの', max_length=100)
64
64
 
65
65
  regist_date = models.DateTimeField(default=timezone.now)
66
66