Revert "Removed unneeded app_label definitions in gis_tests"
This reverts commit e0cc36f615
.
The problem is the following:
* With non-gis backends, gis_tests sub apps are not discovered
(see runtests.py)
* Consequently, the app_label is inferred from the gis_tests
AppConfig
* Then models with same names in different sub apps conflict
because of same model_name/app_label pair.
This commit is contained in:
parent
e0cc36f615
commit
a6bada1ee0
|
@ -10,6 +10,9 @@ class City(models.Model):
|
||||||
|
|
||||||
objects = models.GeoManager()
|
objects = models.GeoManager()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'geoadmin'
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ class Country(NamedModel):
|
||||||
class City(NamedModel):
|
class City(NamedModel):
|
||||||
point = models.PointField()
|
point = models.PointField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'geoapp'
|
||||||
|
|
||||||
|
|
||||||
# This is an inherited model from City
|
# This is an inherited model from City
|
||||||
class PennsylvaniaCity(City):
|
class PennsylvaniaCity(City):
|
||||||
|
@ -34,10 +37,16 @@ class PennsylvaniaCity(City):
|
||||||
|
|
||||||
objects = models.GeoManager()
|
objects = models.GeoManager()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'geoapp'
|
||||||
|
|
||||||
|
|
||||||
class State(NamedModel):
|
class State(NamedModel):
|
||||||
poly = models.PolygonField(null=gisfield_may_be_null) # Allowing NULL geometries here.
|
poly = models.PolygonField(null=gisfield_may_be_null) # Allowing NULL geometries here.
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'geoapp'
|
||||||
|
|
||||||
|
|
||||||
class Track(NamedModel):
|
class Track(NamedModel):
|
||||||
line = models.LineStringField()
|
line = models.LineStringField()
|
||||||
|
|
|
@ -18,6 +18,9 @@ class NamedModel(models.Model):
|
||||||
class City(NamedModel):
|
class City(NamedModel):
|
||||||
point = models.PointField(geography=True)
|
point = models.PointField(geography=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'geogapp'
|
||||||
|
|
||||||
|
|
||||||
class Zipcode(NamedModel):
|
class Zipcode(NamedModel):
|
||||||
code = models.CharField(max_length=10)
|
code = models.CharField(max_length=10)
|
||||||
|
@ -28,5 +31,8 @@ class County(NamedModel):
|
||||||
state = models.CharField(max_length=20)
|
state = models.CharField(max_length=20)
|
||||||
mpoly = models.MultiPolygonField(geography=True)
|
mpoly = models.MultiPolygonField(geography=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'geogapp'
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return ' County, '.join([self.name, self.state])
|
return ' County, '.join([self.name, self.state])
|
||||||
|
|
|
@ -36,11 +36,17 @@ class City(NamedModel):
|
||||||
dt = models.DateField()
|
dt = models.DateField()
|
||||||
point = models.PointField()
|
point = models.PointField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'layermap'
|
||||||
|
|
||||||
|
|
||||||
class Interstate(NamedModel):
|
class Interstate(NamedModel):
|
||||||
length = models.DecimalField(max_digits=6, decimal_places=2)
|
length = models.DecimalField(max_digits=6, decimal_places=2)
|
||||||
path = models.LineStringField()
|
path = models.LineStringField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
app_label = 'layermap'
|
||||||
|
|
||||||
|
|
||||||
# Same as `City` above, but for testing model inheritance.
|
# Same as `City` above, but for testing model inheritance.
|
||||||
class CityBase(NamedModel):
|
class CityBase(NamedModel):
|
||||||
|
|
Loading…
Reference in New Issue