Kim Majali wrote on 26/05/2022
urls.py
from django.contrib.auth import views as auth_views
Read more
Kim Majali wrote on 26/05/2022
# demo_project/settings.py
DEBUG = False
Read more
Kim Majali wrote on 26/05/2022
We make Listing model is our example
in listings/urls.py
Read moreKim Majali wrote on 26/05/2022
We want to show a 404 page if user type a URL of a non-exisiting listing, for example, we have only 5 listings but the requested URL is listing/10 which does not exist.
in views.py
from django.shortcuts import get_object_or_404, render
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from .models import Listing
Read more
Kim Majali wrote on 26/05/2022
Assuming that we need to bring listings from the listings model and show it on the home page which is a part of another model pagesRead more