user3260968
user3260968

Reputation: 11

django invalid syntax(urls.py line 7

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

Answers (1)

falsetru
falsetru

Reputation: 369424

In the following line, the code is missing .:

queryset=Post.objects.all().order_by("-date")[:10],
#                          ^

Upvotes: 4

Related Questions