[Fixed]-Django : cannot reverse URL to generate sitemaps

1👍

In this case, the correct syntax for using reverse is:

reverse('duo', args=['anna'])

0👍

Redefine your location method to following :

def location(self, item):
    return reverse('url_name', args=(arg,))

0👍

Using the previous answers, I did this little piece of code, hope it can be of any help for others users:

def location(self, obj):
    if len(obj) == 1:
        return reverse(obj[0])
    else:
        return reverse(obj[0],args=[obj[1]])

obj are tuple objects declared in urls.py

Leave a comment