Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22790 closed Bug (fixed)

spatialite/Oracle GIS app_label deprecation warnings

Reported by: Tim Graham Owned by: Aymeric Augustin
Component: GIS Version: 1.7-beta-2
Severity: Release blocker Keywords: app-loading
Cc: Aymeric Augustin Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

/home/tim/code/django/django/contrib/gis/db/backends/spatialite/models.py:10:
RemovedInDjango19Warning: Model class django.contrib.gis.db.backends.spatialite.models.GeometryColumns
doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was
imported before its application was loaded. This will no longer be supported in Django 1.9.
  class GeometryColumns(models.Model):
  
/home/tim/code/django/django/contrib/gis/db/backends/spatialite/models.py:47:
RemovedInDjango19Warning: Model class django.contrib.gis.db.backends.spatialite.models.SpatialRefSys
doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was
imported before its application was loaded. This will no longer be supported in Django 1.9.

Tried adding app_label = 'gis' to the models, but ran into another problem:

======================================================================
ERROR: django.contrib.gis.tests.tests (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: django.contrib.gis.tests.tests
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
    __import__(name)
  File "/home/tim/code/django/django/contrib/gis/tests/tests.py", line 9, in <module>
    from django.contrib.gis.db.backends.postgis.operations import PostGISOperations
  File "/home/tim/code/django/django/contrib/gis/db/backends/postgis/operations.py", line 16, in <module>
    from .models import GeometryColumns, SpatialRefSys
  File "/home/tim/code/django/django/contrib/gis/db/backends/postgis/models.py", line 10, in <module>
    class GeometryColumns(models.Model):
  File "/home/tim/code/django/django/db/models/base.py", line 287, in __new__
    new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
  File "/home/tim/code/django/django/apps/registry.py", line 201, in register_model
    (model_name, app_label, app_models[model_name], model))
RuntimeError: Conflicting 'geometrycolumns' models in application 'gis': <class 'django.contrib.gis.db.backends.spatialite.models.GeometryColumns'> and <class 'django.contrib.gis.db.backends.postgis.models.GeometryColumns'>.

Change History (8)

comment:1 by Aymeric Augustin, 11 years ago

Owner: changed from nobody to Aymeric Augustin
Status: newassigned

comment:2 by Aymeric Augustin, 11 years ago

I'm afraid there's no other solution than renaming the backend-specific SpatialSysRef models.

Otherwise you couldn't use Postgis and Spatialite in the same projet.

Version 0, edited 11 years ago by Aymeric Augustin (next)

comment:3 by Aymeric Augustin, 11 years ago

Has patch: set

comment:4 by Aymeric Augustin, 11 years ago

Severity: NormalRelease blocker

Unfortunately I lack the ability to test this on Spatialite and Oracle GIS.

comment:5 by Claude Paroz, 11 years ago

Tested successfully on Spatialite, but one of the models is missing the app_label. Seems one is missing too in Oracle models, but I cannot test Oracle.

comment:6 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 6e5651e514367174a3fa887d6babfe3830339b16:

Gave unique names to SpatialRefSysModels.

Prevented clashes in the app registry.

Fixed #22790. Thanks timo for the report.

comment:7 by Aymeric Augustin, 11 years ago

Thank you Claude, I fixed that oversight before pushing the patch.

comment:8 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 25f4e71ed30befbd6af02a7d35807d0d3170e57d:

[1.7.x] Gave unique names to SpatialRefSysModels.

Prevented clashes in the app registry.

Fixed #22790. Thanks timo for the report.

Backport of 6e5651e from master

Note: See TracTickets for help on using tickets.
Back to Top