Answer the question
In order to leave comments, you need to log in
How to fix django url?
The first request when using django-enless-pagination fails. But when you type the identity into the address bar with pens, everything works correctly. Why is that ? And how can anyone fix it?
[04/Jul/2015 14:33:31]"GET /?page=2&querystring_key=page HTTP/1.1" 500 160329
[04/Jul/2015 14:33:42]"GET /?page=2&querystring_key=page HTTP/1.1" 200 6458
from django.conf.urls import include, url
from django.contrib import admin
from endless_pagination.views import AjaxListView
urlpatterns = [
url(r'^$', 'blog.views.index', name='home'),
url(r'^add/', 'blog.views.add_post', name='add_post'),
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('allauth.urls')),
]
# coding: utf-8
from django.shortcuts import render
from django.http import HttpResponse , HttpResponseRedirect
from django.core.urlresolvers import reverse
from endless_pagination.decorators import page_template
from django.shortcuts import render_to_response
from django.template import RequestContext
from endless_pagination.decorators import page_template
from .models import Posts
@page_template('blog/all_posts.html') # just add this decorator
def index( request, template='blog/post.html', extra_context=None):
post = Posts.objects.all()
context = {'entries':post}
if extra_context is not None:
context.update(extra_context)
return render_to_response(template, context, context_instance=RequestContext(request))
Answer the question
In order to leave comments, you need to log in
[04/Jul/2015 14:33:31]"GET /?page=2&querystring_key=page HTTP/1.1" 500 160329
[04/Jul/2015 14:33:42]"GET /?page=2&querystring_key=page HTTP/1.1" 200 6458
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question