I have a Django application that needs to work with an existent PostGIS database, apart from its own database. I've configured multidatabase support, created a database router, created models for the existent tables in the PostGIS database and told syncdb that, for that models, managed=False (so, it won't create the tables in the database, they already exist)
My problem comes because I need to create distance queries using one of those PostGIS tables. The table stores points objects with srid 4326, and I need to know how many of these points are within a given distance of a reference point (like ST_DWithin).
I'd like to use geography for the distance queries. So, I could define the geom field in the model that maps to that table with geography=True. But the problem is I just have read access to the PostGIS database. So, I can't change the column type to geography. I don't want to write a raw query, transforming the column to geography. Unless there's no other method. Is there a geodjango-friendly way to deal with this?