django-jsonfallback icon indicating copy to clipboard operation
django-jsonfallback copied to clipboard

Does not work correcly on Postgresql with Postgis extensions

Open jrd opened this issue 5 years ago • 1 comments

When using a Postgresql with Postgis extensions, the driver used is a wrapper around the postgres one to handle postgis extensions.

Unfortunately, the driver name does not contains '.postgresql' in the engine name. The engine string is django.contrib.gis.db.backends.postgis

So maybe change some tests like

if '.postgresql' in connection.settings_dict['ENGINE']:

To

if any((
    '.postgresql' in connection.settings_dict['ENGINE'],
    '.postgis' in connection.settings_dict['ENGINE']
)):

Or just shorten the search:

if '.postg' in connection.settings_dict['ENGINE']:

jrd avatar Jun 11 '20 14:06 jrd

I'd be happy to accept a pull request, although keep in mind that we'll probably discontinue this library as soon as django 3.1 has been released and we've found a good migration path:

https://docs.djangoproject.com/en/dev/releases/3.1/#jsonfield-for-all-supported-database-backends

raphaelm avatar Jun 11 '20 14:06 raphaelm