django-stubs
django-stubs copied to clipboard
The type for location in the class Sitemap is wrong.
https://github.com/typeddjango/django-stubs/blob/8d8b8cd1fc8b54eac799905dbbffc4e21708b6da/django-stubs/contrib/sitemaps/init.pyi#L24
The item shouldn't just be Model. As you can see it can also just be a string too if creating a sitemap of pages that aren't in models:
class StaticViewSitemap(Sitemap):
priority = 1
changefreq = "always"
def items(self) -> List[str]:
return ["home", "about", "contact", "recommendations", "privacy-policy", "blog"]
def location(self, item: str) -> str:
return reverse(item)
I have temp got round this by just specifying it with Any but not ideal.