ok, the view function I'm using appears to be importable - because if
I remove the line "print item.get_absolute_url()", the view function
is called appropriately, with the odd exception that all instances
where the template is calling "get_absolute_url( )" are resolving to
the same page.
A clue may be that in the application urls.py file, when I replace
"view=blog_views.post_list" with "view=basicBlog.blog.views.post_list"
it claims to not be able to find "basicBlog"
Here's the complete code, I'm quite stuck on this and appreciate your
help:
urls.py from project root
#*************************************************
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', include('basicBlog.blog.urls')),
(r'^blog/', include('basicBlog.blog.urls')),
(r'^comments/', include('django.contrib.comments.urls')),
(r'^admin/(.*)', admin.site.root),
)
#*************************************************
urls.py from blog application
#*************************************************
from django.conf.urls.defaults import *
from basicBlog.blog import views as blog_views
urlpatterns = patterns('',
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?
P<slug>[-\w]+)/$',
view=blog_views.post_detail,
name='blog_detail'),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$',
view=blog_views.post_archive_day,
name='blog_archive_day'),
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$',
view=blog_views.post_archive_month,
name='blog_archive_month'),
url(r'^(?P<year>\d{4})/$',
view=blog_views.post_archive_year,
name='blog_archive_year'),
url(r'^categories/(?P<slug>[-\w]+)/$',
view=blog_views.category_detail,
name='blog_category_detail'),
url (r'^categories/$',
view=blog_views.category_list,
name='blog_category_list'),
url (r'^search/$',
view=blog_views.search,
name='blog_search'),
url(r'^page/(?P<page>\w)/$',
view=blog_views.post_list,
name='blog_index_paginated'),
url(r'^$',
view=blog_views.post_list,
name='blog_index'),
)
#*************************************************
and views.py for the post_list view:
#*************************************************
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import Http404
from django.views.generic import date_based, list_detail
from basicBlog.blog.models import *
import datetime
import re
def post_list(request, page=0):
queryset = Post.objects.published()
for item in queryset:
print item.get_absolute_url()
return list_detail.object_list(
request,
queryset,
paginate_by = 20,
page = page,
)
post_list.__doc__ = list_detail.object_list.__doc__
# this file goes on...
#*************************************************