-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
'VersionSlugFilter' object is not iterable #2495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same here |
|
I tried this in Replacing: @register.filter
def sort_version_aware(versions):
"""Takes a list of versions objects and sort them using version schemes"""
return sorted(
versions, # <- THIS LINE
key=lambda version: comparable_version(version.verbose_name),
reverse=True) with: @register.filter
def sort_version_aware(versions):
"""Takes a list of versions objects and sort them using version schemes"""
return sorted(
list(versions.qs), # <- THIS LINE
key=lambda version: comparable_version(version.verbose_name),
reverse=True) However, now there's a new error:
...which to me indicates that django-filter is doing stuff that doesn't like lazy ugettext objects. As a new dev, I'm confused about this application django-filter, what it is, why it's there etc. :) Why not use good old custom managers? |
If I add |
This fixes an issue here: readthedocs/readthedocs.org#2495 I'm not sure if this is the preferred way of doing things, nor am I sure if this project is 2+3? But hopefully this can assist getting the issue solved... feel free to close this PR and implement your own way :)
This issue is also reported here: #2490 I see the same issue on
|
Btw. it would seem that the more general issue is that the django-filter API has changed: Filter objects are no longer iterable in themselves, you have to use the The change is described in the 1.0 release notes: http://django-filter.readthedocs.io/en/latest/migration.html#queryset-methods-are-no-longer-proxied |
Myself not being a python dev, most of the discussion is mambo-jumbo ;) |
@fulopattila122 it means if you're running readthedocs locally, then after enabling your virtual env, do this:
|
@benjaoming Thanks! That just worked! |
Details
Expected Result
Open new project
A description of what you wanted to happen
Fresh ReadTheDocs installation
Try to open exists or new project
Actual Result
TypeError at /projects/invoicing/
'VersionSlugFilter' object is not iterable
A description of what actually happened
In template
checkouts/readthedocs.org/readthedocs/templates/core/project_details.html, error at line 35
25
26
27 {{ filter.form }}
28 <input type="submit" value="{% trans "Filter" %}">
29
30
31 {% endcomment %}
32
33
34
35
36
37 {% if version.uploaded or version.built %}
38 {# Link to the docs #}
39
40 {% blocktrans with version.slug as slug %} {{ slug }} {% endblocktrans %}
41 {% if request.user in project.users.all %}
42 {{ version.get_privacy_level_display }}
43 {% endif %}
44
45 {% else %}
The text was updated successfully, but these errors were encountered: