podjango: Remove incomplete "query" view/URLs

This commit is contained in:
Ben Sturmfels 2024-04-24 17:49:26 +10:00
parent e01c27ea3e
commit 5e2bef0c7a
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
3 changed files with 0 additions and 39 deletions

View file

@ -31,8 +31,5 @@
</ul> </ul>
<p><a href="{% url 'podjango:cast' %}">All oggcasts&hellip;</a></p> <p><a href="{% url 'podjango:cast' %}">All oggcasts&hellip;</a></p>
<!-- Query is not working right now! -->
<!-- <p><a href="/podcast/query/">Query...</a></p> -->
{% endblock %} {% endblock %}
{% endcomment %} {% endcomment %}

View file

@ -50,7 +50,6 @@ urlpatterns = [
path('<int:year>/<month>/', MonthArchiveView.as_view(**info_dict), name='month-archive'), path('<int:year>/<month>/', MonthArchiveView.as_view(**info_dict), name='month-archive'),
path('<int:year>/', YearArchiveView.as_view(**info_dict), name='year-archive'), path('<int:year>/', YearArchiveView.as_view(**info_dict), name='year-archive'),
path('all/', custom_index, dict(info_dict, paginate_by=20), name='cast'), path('all/', custom_index, dict(info_dict, paginate_by=20), name='cast'),
path('query/', query, name='query'),
path('feeds/ogg/', OggCastFeed(), name='feed-ogg'), path('feeds/ogg/', OggCastFeed(), name='feed-ogg'),
path('feeds/mp3/', Mp3CastFeed(), name='feed-mp3'), path('feeds/mp3/', Mp3CastFeed(), name='feed-mp3'),
path('feeds/', view, name='feeds'), path('feeds/', view, name='feeds'),

View file

@ -75,38 +75,3 @@ def custom_index(request, queryset, *args, **kwargs):
# TODO # TODO
return render(request, 'podjango/cast/cast_list.html', {'object_list': queryset}) return render(request, 'podjango/cast/cast_list.html', {'object_list': queryset})
def query(request):
"""Page to query the cast based on and tags
"""
if request.GET:
d = request.GET.copy()
if 'authors' in d.getlist('all'):
d.setlist('author', []) # remove author queries
if 'tags' in d.getlist('all'):
d.setlist('tag', []) # remove tag queries
d.setlist('all', []) # remove "all" from the query string
base_url = '/cast/'
if 'rss' in d:
base_url = '/feeds/cast/'
d.setlist('rss', []) # remove it
query_string = d.urlencode()
return relative_redirect(request, '%s%s%s' % (base_url, '?' if query_string else '', query_string))
else:
tags = CastTag.objects.all().order_by('label')
return render(request, 'podjango/cast/query.html', {'tags': tags})
def relative_redirect(request, path):
from django import http
host = http.get_host(request)
url = "%s://%s%s" % (request.is_secure() and 'https' or 'http', host, path)
return http.HttpResponseRedirect(url)