Reputation: 11
this is the mysite/urls.py from a tutorial in making a website with python and django mysiteurls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^blog/', include('blog.urls')),
)
When I try to hit my url I get invalid syntax. What's it not liking?
Essentially I want the view to populate a template XML file I built. please help am creating a website and came across this error in my urls here is my code
blog/urls.py
from django.conf.urls import patterns,url
from django.views.generic import ListView
from blog.models import Post
i get an invalid syntax error on my code when i call it on my localbrowser
urlpatterns = patterns('',
url(r'^',ListView.as_view(
queryset=Post.objects.all()order_by("-date")[:10],
template_name="blog.html")),
)
please help am new to the program
Upvotes: 0
Views: 1366
Reputation: 369424
In the following line, the code is missing .
:
queryset=Post.objects.all().order_by("-date")[:10],
# ^
Upvotes: 4