diff --git a/tubesync/common/templates/pagination.html b/tubesync/common/templates/pagination.html index ae8f138..0e378a8 100644 --- a/tubesync/common/templates/pagination.html +++ b/tubesync/common/templates/pagination.html @@ -3,7 +3,7 @@
diff --git a/tubesync/sync/templates/sync/media.html b/tubesync/sync/templates/sync/media.html index 76ae9ea..521bee8 100644 --- a/tubesync/sync/templates/sync/media.html +++ b/tubesync/sync/templates/sync/media.html @@ -4,9 +4,16 @@ {% block content %}
-
+

Media

+
+ {% if show_skipped %} + Hide skipped media + {% else %} + Show skipped media + {% endif %} +
{% include 'infobox.html' with message=message %}
@@ -48,5 +55,5 @@
{% endfor %}
-{% include 'pagination.html' with pagination=sources.paginator filter=source.pk %} +{% include 'pagination.html' with pagination=sources.paginator filter=source.pk show_skipped=show_skipped %} {% endblock %} diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index d6a7851..c0d5a89 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -438,6 +438,7 @@ class MediaView(ListView): def __init__(self, *args, **kwargs): self.filter_source = None + self.show_skipped = False super().__init__(*args, **kwargs) def dispatch(self, request, *args, **kwargs): @@ -447,13 +448,22 @@ class MediaView(ListView): self.filter_source = Source.objects.get(pk=filter_by) except Source.DoesNotExist: self.filter_source = None + show_skipped = request.GET.get('show_skipped', '').strip() + if show_skipped == 'yes': + self.show_skipped = True return super().dispatch(request, *args, **kwargs) def get_queryset(self): if self.filter_source: - q = Media.objects.filter(source=self.filter_source) + if self.show_skipped: + q = Media.objects.filter(source=self.filter_source) + else: + q = Media.objects.filter(source=self.filter_source, skip=False) else: - q = Media.objects.all() + if self.show_skipped: + q = Media.objects.all() + else: + q = Media.objects.filter(skip=False) return q.order_by('-published', '-created') def get_context_data(self, *args, **kwargs): @@ -464,6 +474,7 @@ class MediaView(ListView): message = str(self.messages.get('filter', '')) data['message'] = message.format(name=self.filter_source.name) data['source'] = self.filter_source + data['show_skipped'] = self.show_skipped return data