Z
Z
zelsky2015-11-20 01:34:39
Django
zelsky, 2015-11-20 01:34:39

Track the djangj page?

I tracked it this way, but when I went to ?page=2 it stopped working where did I go wrong ?
For title and search 3 elements - images, keywords and description
url(r'^$', 'blog.views.index',name='index'),
{% url 'index' as home_url %}
{% if request.get_full_path == home_url %}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-11-20
@zelsky

Here is the problem

request.get_full_path == "/"

home_url == "/?page=2"

cannot be equal in any way.
So in the view, set a variable that will indicate which page you are on and track it, not the url
def home_view(request):
     where_i_am = 'home_page'
....

# html
{% if where_i_am == "home_page" %}...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question