etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 129 forks source link

Add handling for RelatedField pk types #293

Closed CristopherH95 closed 2 years ago

CristopherH95 commented 2 years ago

As was highlighted by #292, lack of proper handling for primary key field types which derive from RelatedField in get_pk_output_field causes errors when running buildwatson. This change adds a simple check to the get_pk_output_field function which will retrieve the field type from the related model instead, to avoid errors.

fixes #292

CristopherH95 commented 2 years ago

From running local tests, it appears as though the build error occurs only with Django 1.11. It looks like the error is occurring while setting up the test database, which the code changed here should have nothing to do with. I wonder if perhaps the latest version of mysqlclient is not compatible with Django 1.11? The last successful build used mysqlclient version 2.0.3, whereas 2.1.0 is now used when the build is run.

Edit: it appears as though mysqlclient version 2.1.0 causes the build error, as when I manually downgrade back to 2.0.3 the tests run no problem. Whereas if I upgrade to 2.1.0 I see the same error as in the CI build, since that is the version installed automatically. This makes me wonder, does Django 1.11 still need to be supported by Watson?

etianen commented 2 years ago

I'm happy to drop Django 1.x from the test matrix. Go ahead and do that in this MR! Otherwise, this is a nice elegant fix, and good to merge once we fix the tests.

CristopherH95 commented 2 years ago

Apologies for the slow update, the most recent commit should remove 1.x from the test matrix!

etianen commented 2 years ago

Merged! I'll cut a release.