On Wed, Feb 10, 2016 at 06:01:28AM -0800, Kelvin Jayanoris wrote:
> It seems that django/contrib/sitemaps/__init__.py line 146 causes an
> attribute error sometimes as such:
>
> AttributeError: 'list' object has no attribute 'filter'
>
> I think this is because it always expects a queryset and fails when a list
> is provided.
>
> Is this a known issue, or not an issue at all?
Hi Kelvin,
I'm assuming that the AttributeError occurs in cases where you pass a
list into the "queryset" key of a GenericSitemap's "info_dict". Is
there any indication in the docs that a list should be supported
there? If that's the case, then it is a bug (either in the docs, or
with the implementation), but according to
https://docs.djangoproject.com/en/1.9/ref/contrib/sitemaps/#django.contrib.sitemaps.GenericSitemap
only a queryset is supported there, not a regular list of objects.
If you need to create a sitemap with a regular list instead of a
queryset, you might want to consider creating your own subclass of
Sitemap, and override its "items" method.
Good luck,
Michal
>
> Thank you guys.
>
> Sorry if I broke any rules (I'm new here)
>
>
> Kelvin
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
django-users...@googlegroups.com.
> To post to this group, send email to
django...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/8e12c895-f697-424c-bf09-ef658a8033eb%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.