clokep / django-querysetsequence

Chain multiple (disparate) QuerySets in Django
https://django-querysetsequence.readthedocs.io/
ISC License
107 stars 25 forks source link

NotImplementedError: QuerySequence does not implement get_compiler() #30

Closed Areopagitics closed 7 years ago

Areopagitics commented 7 years ago

Hi there, after installing django-autocomplete-light which uses QuerySequence I've been getting this error: NotImplementedError: QuerySequence does not implement get_compiler() ; I started an issue under django-autocomplete-light originally. Here is the traceback:

(InteractiveConsole)
>>> from queryset_sequence import QuerySetSequence
>>> from .models import *
>>> cities = City.objects.all()
>>> qs = QuerySetSequence(cities)
>>> qs
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Users\Areopagitics\Development\env-dev\lib\site-packages\django\db\models\query.py", line 226, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "C:\Users\Areopagitics\Development\env-dev\lib\site-packages\django\db\models\query.py", line 250, in __iter__
    self._fetch_all()
  File "C:\Users\Areopagitics\Development\env-dev\lib\site-packages\django\db\models\query.py", line 1105, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "C:\Users\Areopagitics\Development\env-dev\lib\site-packages\django\db\models\query.py", line 50, in __iter__
    compiler = queryset.query.get_compiler(using=db)
  File "C:\Users\Areopagitics\Development\env-dev\lib\site-packages\queryset_sequence\_inheritance.py", line 43, in not_impl
    (name, attr))
NotImplementedError: QuerySequence does not implement get_compiler()
clokep commented 7 years ago

Are you using Django 1.11? django-querysetsequence currently only supports up to Django 1.10. I suspect #26 would solve this.

If this isn't the case, let me know!

Areopagitics commented 7 years ago

Yuppeee! It worked with Django 1.10! Thanks!

what a pain for you to have to keep on updating this! I guess it's just the way python is... not backwards compatible.

clokep commented 7 years ago

Django (not Python, in this case) sometimes breaks backwards compatibility. Unfortunately this library touches a lot of internal APIs that aren't guaranteed to be stable, so this happens...

michael-k commented 7 years ago

I suspect #26 would solve this.

I can confirm that it does.

thclark commented 7 years ago

Dual confirmation here :)

clokep commented 7 years ago

Thanks. Unfortunately that branch has a bunch of tests failing on it. I haven't had time to look back into it yet. Any help would be appreciated! 👍

michael-k commented 7 years ago

@clokep I looked into it and opened PR #32

clokep commented 7 years ago

This should be fixed now!