podjango: Remove incomplete "query" view/URLs
This commit is contained in:
parent
e01c27ea3e
commit
5e2bef0c7a
3 changed files with 0 additions and 39 deletions
|
@ -31,8 +31,5 @@
|
|||
</ul>
|
||||
|
||||
<p><a href="{% url 'podjango:cast' %}">All oggcasts…</a></p>
|
||||
<!-- Query is not working right now! -->
|
||||
<!-- <p><a href="/podcast/query/">Query...</a></p> -->
|
||||
|
||||
{% endblock %}
|
||||
{% endcomment %}
|
||||
|
|
|
@ -50,7 +50,6 @@ urlpatterns = [
|
|||
path('<int:year>/<month>/', MonthArchiveView.as_view(**info_dict), name='month-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('query/', query, name='query'),
|
||||
path('feeds/ogg/', OggCastFeed(), name='feed-ogg'),
|
||||
path('feeds/mp3/', Mp3CastFeed(), name='feed-mp3'),
|
||||
path('feeds/', view, name='feeds'),
|
||||
|
|
|
@ -75,38 +75,3 @@ def custom_index(request, queryset, *args, **kwargs):
|
|||
|
||||
# TODO
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue