openwisp / django-rest-framework-gis

Geographic add-ons for Django REST Framework. Maintained by the OpenWISP Project.
http://openwisp.org
MIT License
1.08k stars 200 forks source link

Add schema generation support for plain GeometryFields #259

Closed AndrewGuenther closed 3 years ago

AndrewGuenther commented 3 years ago

The intial implementation of schema generation only supported serializers which subclassed GeoFeatureModel*Serializer. This meant that models which have standalone GeometryFields would not properly generate a schema. This change adds support for that use case.

Fixes #257

AndrewGuenther commented 3 years ago

Fairly simple change, but looking for some feedback on the best way to write a test for this.

AndrewGuenther commented 3 years ago

I believe I've resolved all the issues. Fwiw, the run-qa-checks script is pretty busted on anything but a clean checkout. It tries to run checks on files in the .gitignore and virtual environments so it always failed for me locally. Could have saved a round trip if that had worked locally.

AndrewGuenther commented 3 years ago

I'd say it's a pure bug fix. The documentation says that schema generation is supported, but it was only working for a specific case. This change ensures that schema generation works for all field types.

AndrewGuenther commented 3 years ago

The test failures seem related to some DB setup, not anything to do with this change.

dhaval-mehta commented 3 years ago

LGTM @dhaval-mehta @auvipy any idea why this failure? "database connection isn't set to UTC". Looks a psycopg issue to me, most probably is happening in master as well.

Yes. https://github.com/psycopg/psycopg2/issues/1293 @nemesisdesign Please re-approve PR.