質問編集履歴

1

追記

2021/04/13 06:38

投稿

Mario_11
Mario_11

スコア95

test CHANGED
File without changes
test CHANGED
@@ -97,3 +97,55 @@
97
97
  </script>
98
98
 
99
99
  ```
100
+
101
+
102
+
103
+ 追記
104
+
105
+ アイコン部分の処理
106
+
107
+
108
+
109
+ ```html
110
+
111
+ <div class="card-content">
112
+
113
+ <form action="{% url 'app:like-post-view' %}" method="POST" class='like-form' id='{{item.id}}'>
114
+
115
+ {% csrf_token %}
116
+
117
+ <input type="hidden" name="post_id" value={{item.id}}>
118
+
119
+ <button type="submit" class="ui button like-btn{{item.id}}">
120
+
121
+ {% if user not in item.liked.all %}
122
+
123
+ <i class="bi bi-heart"></i><div class="like-count{{item.id}}"></div>
124
+
125
+ {% else %}
126
+
127
+ <i class="bi bi-heart-fill like"></i><div class="like-count{{item.id}}"></div>
128
+
129
+ {% endif %}
130
+
131
+ </button>
132
+
133
+ </form>
134
+
135
+ <div class="like-count{{item.id}}">{{item.num_likes}}</div>
136
+
137
+ {% if item.post_user.icon %}
138
+
139
+ <a href="#" class="card-link" href="{% url 'app:user_detail' item.post_user %}">
140
+
141
+ <img src="{{ item.post_user.icon.url }}" width="20%">
142
+
143
+ {% endif %}
144
+
145
+ {{ item.post_user }}
146
+
147
+ </a>
148
+
149
+ </div>
150
+
151
+ ```