mattiaslinnap / django-partial-index

PostgreSQL and SQLite partial index support for Django
BSD 3-Clause "New" or "Revised" License
116 stars 12 forks source link

Adds compatibility for Django 2.0 #7

Closed theGOTOguy closed 6 years ago

theGOTOguy commented 6 years ago

In Django 2.0, positional arguments are no longer accepted by model.Index. With this tiny change django-partial-index is now Django 2.0 compatible.

theGOTOguy commented 6 years ago

Oh, I see that your tests are broken because your continuous CI is set to use the newest Django version where the tests themselves are broken by newly-required fields. I only tested against 1.11, and then copied the changed file into my Django 2.0 project using django-partial-index.

mattiaslinnap commented 6 years ago

Thanks for the PR! I'll merge and then fix the tests today.

vesterbaek commented 6 years ago

@mattiaslinnap any chance of getting this merged and into a new release?

mattiaslinnap commented 6 years ago

Hi @vesterbaek, @theGOTOguy, @sjamaan,

Adding support for Django 2.0 was a little bit trickier than I expected - the "CREATE INDEX ..." templates and parameters have been moved from the Index class to SchemaEditor in Django 2.0.

I have an attempt that looks good ready in branch: https://github.com/mattiaslinnap/django-partial-index/tree/django20

It seems to pass tests for various combinations of Python and Django version: https://travis-ci.org/mattiaslinnap/django-partial-index/builds/324252456

However, it will take me some days to update my projects to Django 2.0 for real production testing.

Could you please try installing django-partial-index with

pip install git+https://github.com/mattiaslinnap/django-partial-index.git@django20

and let me know if it looks good for public release?

sjamaan commented 6 years ago

Very nice! I've upgraded my project to Django 2.0 and everything seems to work as it should.

Of course, to test it in my project I also had to rebase my changes from #5 onto this version (in another branch: https://github.com/CodeYellowBV/django-partial-index/tree/django2), so once you decide to release this I can update that pull request to work for Django 2 as well.

vesterbaek commented 6 years ago

Ho @mattiaslinnap. Thanks. Yup, this works for me on 2.0

mattiaslinnap commented 6 years ago

Version 0.4.0 with Django2 support is now available on PyPI, and as a release on github.

vesterbaek commented 6 years ago

Thanks. Appreciated. Have a good weekend