From 74ccaf27facd6b3f41fcad68bba28e9112b3f26a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 22 Apr 2021 18:23:23 -0700 Subject: [PATCH] Tag removal migration --- .../migrations/0070_auto_20210423_0121.py | 35 +++++++++++++++++++ bookwyrm/templates/snippets/tag.html | 23 ------------ bookwyrm/templates/tag.html | 14 -------- bookwyrm/views/books.py | 7 ---- 4 files changed, 35 insertions(+), 44 deletions(-) create mode 100644 bookwyrm/migrations/0070_auto_20210423_0121.py delete mode 100644 bookwyrm/templates/snippets/tag.html delete mode 100644 bookwyrm/templates/tag.html diff --git a/bookwyrm/migrations/0070_auto_20210423_0121.py b/bookwyrm/migrations/0070_auto_20210423_0121.py new file mode 100644 index 000000000..90540ae12 --- /dev/null +++ b/bookwyrm/migrations/0070_auto_20210423_0121.py @@ -0,0 +1,35 @@ +# Generated by Django 3.1.8 on 2021-04-23 01:21 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0069_auto_20210422_1604'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='usertag', + unique_together=None, + ), + migrations.RemoveField( + model_name='usertag', + name='book', + ), + migrations.RemoveField( + model_name='usertag', + name='tag', + ), + migrations.RemoveField( + model_name='usertag', + name='user', + ), + migrations.DeleteModel( + name='Tag', + ), + migrations.DeleteModel( + name='UserTag', + ), + ] diff --git a/bookwyrm/templates/snippets/tag.html b/bookwyrm/templates/snippets/tag.html deleted file mode 100644 index 507def723..000000000 --- a/bookwyrm/templates/snippets/tag.html +++ /dev/null @@ -1,23 +0,0 @@ -{% load i18n %} -
-
- {% csrf_token %} - - - -
- - {{ tag.tag.name }} - - {% if tag.tag.identifier in user_tags %} - - {% else %} - - {% endif %} -
-
-
diff --git a/bookwyrm/templates/tag.html b/bookwyrm/templates/tag.html deleted file mode 100644 index b6fa67783..000000000 --- a/bookwyrm/templates/tag.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'layout.html' %} -{% load i18n %} -{% load bookwyrm_tags %} - -{% block title %}{{ tag.name }}{% endblock %} - -{% block content %} -
-

{% blocktrans %}Books tagged "{{ tag.name }}"{% endblocktrans %}

- {% include 'snippets/book_tiles.html' with books=books.all %} -
-{% endblock %} - - diff --git a/bookwyrm/views/books.py b/bookwyrm/views/books.py index 0c61d1a20..34ebe0b68 100644 --- a/bookwyrm/views/books.py +++ b/bookwyrm/views/books.py @@ -57,12 +57,7 @@ class Book(View): ) reviews_page = paginated.get_page(request.GET.get("page")) - user_tags = readthroughs = user_shelves = other_edition_shelves = [] if request.user.is_authenticated: - user_tags = models.UserTag.objects.filter( - book=book, user=request.user - ).values_list("tag__identifier", flat=True) - readthroughs = models.ReadThrough.objects.filter( user=request.user, book=book, @@ -87,11 +82,9 @@ class Book(View): "review_count": reviews.count(), "ratings": reviews.filter(Q(content__isnull=True) | Q(content="")), "rating": reviews.aggregate(Avg("rating"))["rating__avg"], - "tags": models.UserTag.objects.filter(book=book), "lists": privacy_filter( request.user, book.list_set.filter(listitem__approved=True) ), - "user_tags": user_tags, "user_shelves": user_shelves, "other_edition_shelves": other_edition_shelves, "readthroughs": readthroughs,