Skip to content
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

Update InheritanceIterable to inherit from ModelIterable instead of BaseIterable #279

Merged
merged 2 commits into from
May 2, 2018

Conversation

hanleyhansen
Copy link
Member

@hanleyhansen hanleyhansen commented Jun 23, 2017

Problem

This PR addresses issue #277

Solution

The solution required updating InheritanceIterable to inherit from ModelIterable instead of BaseIterable to avoid the exception thrown in Django 1.11's query.py:

if queryset is not None and not issubclass(queryset._iterable_class, ModelIterable):
    raise ValueError('Prefetch querysets cannot use values().')

The test exposes that this was broken in Django 1.10 also, hence the skipIf. However, in Django 1.10 the if requires a ModelIterable not just a subclass of it which is a lot more restrictive:

if queryset is not None and queryset._iterable_class is not ModelIterable:
    raise ValueError('Prefetch querysets cannot use values().')

Commandments

  • Write PEP8 compliant code.
  • Cover it with tests.
  • Update CHANGES.rst file to describe the changes, and quote according issue with GH-<issue_number>.
  • Pay attention to backward compatibility, or if it breaks it, explain why.

@nherzing
Copy link

nherzing commented Aug 2, 2017

Any timeline for getting this merged?

@wmorrell
Copy link

It's been four months since the PR submitted, could this please get merged in? As of now, django-model-utils will not work with Django 1.11+ if a Prefetch is used.

@and3rson
Copy link

and3rson commented Nov 7, 2017

Any updates? This is absolutely critical.

@eranrund
Copy link

Any news? This is making our lives hard :(

@geoolekom
Copy link

Please, merge it, prefetching is essential for us.

@jezdez
Copy link
Member

jezdez commented May 2, 2018

Hey folks, a Jazzband roadie here.

Did you know you can merge this yourself? Simply join Jazzband and you'll able to help out directly with maintenance of this package.

Check out the Jazzband FAQ for more info what Jazzband is and how it works.

@hanleyhansen
Copy link
Member Author

Thanks @jezdez. Just joined!

@hanleyhansen hanleyhansen merged commit 18dfb6b into jazzband:master May 2, 2018
@hanleyhansen hanleyhansen deleted the inheritance-iterable branch May 2, 2018 18:14
@hanleyhansen
Copy link
Member Author

@jezdez do we also manage pypi releases?

@jezdez
Copy link
Member

jezdez commented May 2, 2018

@hanleyhansen Releases happen semi-automatic as documented on the Releases site, basically @carljm will need to approve a release manually once a Git tag has been cut which triggers the upload to the release stage. Make sure to update the version number in the various places (e.g. model_utils/__init__.py) before you create the tag and document the changes according to the project's practices.

joaoamaro70 pushed a commit that referenced this pull request May 9, 2018
Update InheritanceIterable to inherit from ModelIterable instead of BaseIterable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants