Add Filter in the Listings Page
Learn how to add a filter in the Listings view and template.
After creating the filter, add it to the Listings page. To do this, we need to update the Listings view and template.
Adding a filter in Listings view
We add the filter in the all_listings
view in views.py.
""" ASGI config for example project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings') application = get_asgi_application()
Listings page with filter
In ...