-
Notifications
You must be signed in to change notification settings - Fork 771
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
[2.1.0] BaseCSVWidget.value_from_datadict — AttributeError: 'list' object has no attribute 'split' #1103
Comments
Hi @moseb. Can you paste the FilterSet code that you're using? The last few lines of the trace back are sufficient to determine why you'd hit this exception. |
Full traceback:
|
It's from browsing a listing where django-rest-framework generates the code. |
To be honest, I haven't found any in that area of the code, yet. It might be all by DRF. Not sure yet. |
Your API view should have either a |
I found use of |
v2.0 removed a lot of the existing deprecation warnings, so you might try running your test suite against v1.0 and then v1.1 of django-filter. |
Assuming this will resolve itself when you update. Come back if not. |
There is reproducible demo of the issue now at https://github.com/moseb/django-filter-issue-1103-demo. Please consider re-opening this issue. Thank you! |
Ah, this is related to You shouldn't need an |
Hi!
Is there existing tickets on GitHub for these issues? It sounds like making
PS: Can we re-open this ticket? |
Possibly. If the value is already a list, it should just go ahead and return that list. That said, I don't think it makes sense to mix the CSV-behavior with the
The MyModel.objects.filter(Q(m2m='a') | Q(m2m='b')) With the 2.1 release, the MyModel.objects.filter(Q(m2m__in='a') | Q(m2m__in='b')) The above is invalid and would break, however it makes sense for So, in short, all you need to do here is use the I think the todo here is:
|
Yeah, this still doesn't look like a bug but how it all works is under documented I guess... |
I just had this error and its explanation is buried in this thread, so to recap and save a long search for future readers:
A warning at runtime would be very appreciated. |
@marcosox Good idea. Happy to look at a PR adding that! |
This change should help close carltongibson#1103
I ran into …
and found that the code at …
django-filter/django_filters/widgets.py
Lines 195 to 202 in 1f47e36
… is not robust with regard to
super().value_from_datadict(data, files, name)
returning a list. I need to debug this more but maybe you already know what's going on here?The text was updated successfully, but these errors were encountered: