Shelf lists
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 12 Dec 2025 14:01:33 +0000 (15:01 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 12 Dec 2025 14:01:33 +0000 (15:01 +0100)
src/social/templates/social/my_shelf.html
src/social/views.py

index c23eeaf..9e3a21f 100644 (file)
 {% endblock %}
 
 {% block main %}
 {% endblock %}
 
 {% block main %}
+{% for list in favs %}
   <div class="l-section">
     <div class="l-author__header">
   <div class="l-section">
     <div class="l-author__header">
-      <h1>{% trans "Półka" %}</h1>
+      <h1>{% trans "Ulubione" %}</h1>
     </div>
   </div>
 
     </div>
   </div>
 
     <div class="l-books__header">
       <div class="l-books__input">
         <i class="icon icon-filter"></i>
     <div class="l-books__header">
       <div class="l-books__input">
         <i class="icon icon-filter"></i>
-        <input type="text" placeholder="{% trans 'filtry, tytuł' %}" class="quick-filter" data-for="book-list" data-filters="with-filter">
-      </div>
-      <div class="l-books__sorting">
-        <span>{% trans "Sortuj:" %}</span>
-        <div>
-          <button data-order="data-pop">{% trans "najpopularniejsze" %}</button>
-          <button class="is-active">{% trans "alfabetycznie" %}</button>
-          <!--button>chronologicznie</button-->
-        </div>
+        <input type="text" placeholder="{% trans 'filtry, tytuł' %}" class="quick-filter" data-for="book-list-l{{ list.id }}" data-filters="with-filter">
       </div>
     </div>
   </div>
       </div>
     </div>
   </div>
-
-  <div class="with-filter">
-
-    <div class="row">
-      <h2 class="header">&nbsp;</h2>
-      {% if suggest %}
-        <div class="filter-container">
-          {% with list_type='book' %}
-            {% for tag in suggest %}
-              <span class="filter filter-category-{{ tag.category }}">
-                <a href="{% catalogue_url list_type tag %}">{{ tag }}</a>
-              </span>
-            {% endfor %}
-          {% endwith %}
-        </div>
+  <div class="l-section l-section--col">
+    <div class="l-books__grid" id="book-list-l{{ list.id }}">
+      {% for item in list.userlistitem_set.all %}
+      {% with book=item.book %}
+      {% if book %}
+      {% include "catalogue/book_box.html" %}
       {% endif %}
       {% endif %}
+      {% endwith %}
+      {% endfor %}
     </div>
   </div>
     </div>
   </div>
+{% endfor %}
 
 
 
 
+{% for list in others %}
+  <div class="l-section" style="margin-top:60px;">
+    <div class="l-author__header">
+      <h1>{{ list.name }}</h1>
+    </div>
+  </div>
 
 
+  <div class="l-section">
+    <div class="l-books__header">
+      <div class="l-books__input">
+        <i class="icon icon-filter"></i>
+        <input type="text" placeholder="{% trans 'filtry, tytuł' %}" class="quick-filter" data-for="book-list-l{{ list.id }}" data-filters="with-filter">
+      </div>
+    </div>
+  </div>
   <div class="l-section l-section--col">
   <div class="l-section l-section--col">
-    <div class="l-books__grid" id="book-list">
-      {% for book in books %}
-        {% include "catalogue/book_box.html" %}
+    <div class="l-books__grid" id="book-list-l{{ list.id }}">
+      {% for item in list.userlistitem_set.all %}
+      {% with book=item.book %}
+      {% if book %}
+      {% include "catalogue/book_box.html" %}
+      {% endif %}
+      {% endwith %}
       {% endfor %}
     </div>
   </div>
       {% endfor %}
     </div>
   </div>
+{% endfor %}
 
 {% endblock %}
 
 {% endblock %}
index 0ff0771..df944b3 100644 (file)
@@ -68,13 +68,15 @@ def unlike_book(request, slug):
 @login_required
 def my_shelf(request):
     template_name = 'social/my_shelf.html'
 @login_required
 def my_shelf(request):
     template_name = 'social/my_shelf.html'
+    favs = request.user.userlist_set.filter(favorites=True)
+    others = request.user.userlist_set.filter(favorites=False)
     ulists = list(request.user.userlist_set.all())
     suggest = [t for t in ulists if t.name]
         
     return render(request, template_name, {
     ulists = list(request.user.userlist_set.all())
     suggest = [t for t in ulists if t.name]
         
     return render(request, template_name, {
-        'tags': ulists,
-        'books': Book.objects_filter(userlistitem__list__user=request.user),
-        'suggest': suggest,
+        'favs': favs,
+        'others': others,
+        #'books': Book.objects.filter(userlistitem__list__user=request.user),
     })
 
 
     })