Django Sitemap not returning items
I have a basic sitemap created. However I'm looking to make it more Google compliant.
I have a queryset that works however when I try and access the url.items in my custom template I only get the default 'priority', lastmod etc...
Sitemaps.py
from django.contrib.sitemaps import Sitemap
from myapp.models import *
class mySitemap(Sitemap):
changefreq = "daily"
priority = 0.5
def items(self):
articles =
sync_Binder.objects.select_related() \
.filter(sync_binder_index__p开发者_如何学Pythonlatform_id > = '2') \
.order_by('sync_binder_index__rank')
return articles
def lastmod(self, obj):
return obj.modifieddate
urls.py
sitemaps = {'mysitemap': mySitemap,}
urlpatterns = patterns('django.contrib.sitemaps.views',
(r'^%ssitemap.xml$' % PROJECT_URL, 'sitemap',
{'sitemaps':sitemaps, 'template_name':'sitemap.html'}),
)
sitemap.html contains the following loop
{% for url in urlset %}
{{ url.items }}
{% endfor %}
...yet I only get the defaults nothing from my articles query set which contains images, headlines etc
Any suggestions?
Thanks S
精彩评论