Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27307 closed Bug (fixed)

sitemap url examples missing names

Reported by: Oleksandr Shtalinberg Owned by: Tim Graham
Component: Documentation Version: 1.10
Severity: Normal Keywords: sitemap
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I did as documentation example
https://docs.djangoproject.com/en/1.10/ref/contrib/sitemaps/#creating-a-sitemap-index

from django.contrib.sitemaps import views as sm_views

class PagesSitemap(Sitemap):
    changefreq = "monthly"
    i18n=True

    def __init__(self, language):
        self.language = language

    def items(self):
        return Pages.objects.filter(is_show=True)

sitemaps = {}
for language in settings.LANGUAGES:
     sitemaps['pages-%s' % language[0]] = PagesSitemap(language[0])

urlpatterns += [
     url(r'^sitemap.xml$', sm_views.index, {'sitemaps': sitemaps}),
     url(r'^sitemap-(?P<section>.+)\.xml$', sm_views.sitemap, {'sitemaps': sitemaps}),
 ]

and get error

NoReverseMatch at /sitemap.xml
Reverse for 'django.contrib.sitemaps.views.sitemap' with arguments '()' and keyword arguments '{'section': 'pages-en'}' not found. 0 pattern(s) tried: []
Request Method:	GET
Request URL:	http://127.0.0.1:8101/sitemap.xml
Django Version:	1.10.2
Exception Type:	NoReverseMatch
Exception Value:	
Reverse for 'django.contrib.sitemaps.views.sitemap' with arguments '()' and keyword arguments '{'section': 'pages-en'}' not found. 0 pattern(s) tried: []
Exception Location:	.venv/local/lib/python2.7/site-packages/django/urls/resolvers.py in _reverse_with_prefix, line 392
Python Executable:	.venv/bin/python
Python Version:	2.7.9

before update to 1.10.x - it's worked well with Django = 1.6.x to 1.9.x
truble only with 1.10.x

Attachments (1)

27273.diff (1019 bytes ) - added by Tim Graham 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Tim Graham, 8 years ago

Component: contrib.sitemapsDocumentation
Owner: changed from nobody to Tim Graham
Status: newassigned
Summary: Truble with Creating a sitemap indexsitemap url examples missing names
Triage Stage: UnreviewedAccepted

by Tim Graham, 8 years ago

Attachment: 27273.diff added

comment:2 by Tim Graham, 8 years ago

Has patch: set

Could you confirm that changing your url() as done in the attached patch fixes it?

comment:3 by Oleksandr Shtalinberg, 8 years ago

Yes, patch fixes it . Thanks!

comment:4 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In fe1aee6:

Fixed #27307 -- Added missing url names in sitemaps docs.

comment:5 by Tim Graham <timograham@…>, 8 years ago

In 69a2d0c:

[1.9.x] Fixed #27307 -- Added missing url names in sitemaps docs.

Backport of fe1aee6b98d2a94ecc983463938135d192ef9afc from master

comment:6 by Tim Graham <timograham@…>, 8 years ago

In 67fd51a5:

[1.10.x] Fixed #27307 -- Added missing url names in sitemaps docs.

Backport of fe1aee6b98d2a94ecc983463938135d192ef9afc from master

comment:7 by Tim Graham <timograham@…>, 8 years ago

In 3141b79:

[1.8.x] Fixed #27307 -- Added missing url names in sitemaps docs.

Backport of fe1aee6b98d2a94ecc983463938135d192ef9afc from master

Note: See TracTickets for help on using tickets.
Back to Top