Django-tastypie: Django 2.0 support

Created on 30 Oct 2017  ·  6Comments  ·  Source: django-tastypie/django-tastypie

Django 2.0 is currently in beta.

tastypie/resources.py:2036: AttributeError
        if getattr(self._meta, 'queryset', None) is not None:
            # Get the possible query terms from the current QuerySet.
>           query_terms = self._meta.queryset.query.query_terms
E           AttributeError: 'Query' object has no attribute 'query_terms'

It seems like internal attribute query_terms will be removed.
In order to have a smooth transition for the users once it is released, this should be resolved.

Most helpful comment

how's it going? :)

All 6 comments

This is actually already fixed in #1520. Just needs to be released to PyPI. @georgedorn

ahhhh OK, thanks.. glad I found this, saved me a lot of trouble as I am just beginning with django / tastypie (FYI : this issue will impact any beginner using basic examples)

ack, I get a new stack trace now, (after installing tastyPie from master)
I'll have to abandon using tastypie for now, (as a beginner, i need to focus on just getting my base code to work). Here's the stacktrace for posterity, let me know if you'd like me to open a new ticket.

Traceback (most recent call last):
File "C:\venv\lib\site-packages\tastypie\resources.py", line 227, in wrapper
response = callback(request, args, *kwargs)
File "C:\venv\lib\site-packages\tastypie\resources.py", line 467, in dispatch_list
return self.dispatch('list', request, *kwargs)
File "C:\venv\lib\site-packages\tastypie\resources.py", line 499, in dispatch
response = method(request, *
kwargs)
File "C:\venv\lib\site-packages\tastypie\resources.py", line 1363, in get_list
for obj in to_be_serialized[self._meta.collection_name]
File "C:\venv\lib\site-packages\tastypie\resources.py", line 1363, in
for obj in to_be_serialized[self._meta.collection_name]
File "C:\venv\lib\site-packages\tastypie\resources.py", line 918, in full_dehydrate
data[field_name] = method(bundle)
File "C:\venv\lib\site-packages\tastypie\resources.py", line 1091, in dehydrate_resource_uri
return self.get_resource_uri(bundle)
File "C:\venv\lib\site-packages\tastypie\resources.py", line 836, in get_resource_uri
return self._build_reverse_url(url_name, kwargs=self.resource_uri_kwargs(bundle_or_obj))
File "C:\venv\lib\site-packages\tastypie\resources.py", line 815, in resource_uri_kwargs
kwargs.update(self.detail_uri_kwargs(bundle_or_obj))
File "C:\venv\lib\site-packages\tastypie\resources.py", line 792, in detail_uri_kwargs
kwargs[self._meta.detail_uri_name] = getattr(bundle_or_obj, self._meta.detail_uri_name)
AttributeError: 'dict' object has no attribute 'pk'

how's it going? :)

When will there be a new release? currently Tastypie 0.14 has been out for quite a while.

1520 has been merged on 12 July 2017 but there has been no new release for with the fix.

Superceded by #1546.

Was this page helpful?
0 / 5 - 0 ratings