B
B
blackbb2015-11-24 19:38:23
Django
blackbb, 2015-11-24 19:38:23

How to make django-filter show up on every page?

Hello! I'm using django-filter for filtering in a bulletin board project, since manually writing filters is a pain. Here is an example of one request:

def filter(request):
    if ('hotels' and 'place' and 'men' and 'pitanie' and 'stoyanka' and 'beach' and 'child' and 'bassein' and 'internet' and 'sauna' and 'tv') in request.GET:
        newvar = Hotels.objects.filter(category__slug='hotels').filter(place__title=request.GET['place']).filter(pitanie=True,stoyanka=True,beach=True,child=True,bassein=True,internet=True,sauna=True,tv=True)
        return render_to_response('filter.html',{'newvar':newvar,})

How do I get django-filter on every page? There is no information in the documentation, I tried using template tags and it did not work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Skver0, 2015-11-25
@blackbb

create a separate template with a filter and add it to the base html.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question