我正在开发一个 GeoDjango 项目(第一次在网络应用程序中工作)。尝试使用 GeoManager,但弹出错误,提示模块“django.contrib.gis.db.models”没有属性“GeoManager”
。之后我查了release notes of Django 2.0发现 Django 2.0 中删除了 GeoManager
和 GeoQuerySet
类。
有人知道它现在在哪个模块吗?或者谁能提出更好的替代方案
最佳答案
它们在 Django 1.9 中已被弃用,因为现在有函数正在取代它们。
All GeoQuerySet methods have been deprecated and replaced by equivalent database functions. As soon as the legacy methods have been replaced in your code, you should even be able to remove the special GeoManager from your GIS-enabled classes.
关于python - 在模块 django.contrib.gis.db 中找不到 GeoManager。 Django 2.0 中的模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48839817/