回答編集履歴

2

修正

2020/05/06 03:41

投稿

ForestSeo
ForestSeo

スコア2722

test CHANGED
@@ -36,11 +36,13 @@
36
36
 
37
37
 
38
38
 
39
- def show(request):
39
+ class UserDetail(generic.DetailView):
40
40
 
41
- items = Item.objects.filter(post_user=request.user)
41
+ def get(self, request):
42
42
 
43
+ items = Item.objects.filter(post_user=request.user)
44
+
43
- return render(request, “HTML”, {items: items})
45
+ return render(request, “HTML”, {items: items})
44
46
 
45
47
  ```
46
48
 

1

修正

2020/05/06 03:41

投稿

ForestSeo
ForestSeo

スコア2722

test CHANGED
@@ -16,11 +16,13 @@
16
16
 
17
17
  # admin.py
18
18
 
19
+ from django.contrib import admin
20
+
19
21
  from . import models
20
22
 
21
23
 
22
24
 
23
- admin.site.register(Item)
25
+ admin.site.register(models.Item)
24
26
 
25
27
  ```
26
28
 
@@ -29,6 +31,10 @@
29
31
  ```Python
30
32
 
31
33
  # views
34
+
35
+ from . import models
36
+
37
+
32
38
 
33
39
  def show(request):
34
40
 
@@ -46,8 +52,6 @@
46
52
 
47
53
  {{item.content}}
48
54
 
49
-
50
-
51
55
  {% endfor %}
52
56
 
53
57
  ```