add admin1 and admin2 to Feature (models, admin and imports)
This commit is contained in:
parent
147a5d57f5
commit
10d4e70648
|
@ -64,7 +64,7 @@ class FeatureAdmin(admin.OSMGeoAdmin):
|
||||||
search_fields = ['preferred_name']
|
search_fields = ['preferred_name']
|
||||||
# list_filter = ('feature_type',)
|
# list_filter = ('feature_type',)
|
||||||
inlines = [FeatureNamesInline]
|
inlines = [FeatureNamesInline]
|
||||||
list_display = ('__unicode__', 'feature_type_name', 'time_start', 'time_end',)
|
list_display = ('__unicode__', 'feature_type_name', 'admin1', 'admin2', 'time_start', 'time_end',)
|
||||||
list_per_page = 30
|
list_per_page = 30
|
||||||
# list_filter = (FeatureTypeFilter,)
|
# list_filter = (FeatureTypeFilter,)
|
||||||
openlayers_url = 'http://openlayers.org/dev/OpenLayers.js'
|
openlayers_url = 'http://openlayers.org/dev/OpenLayers.js'
|
||||||
|
|
|
@ -36,6 +36,8 @@ def import_gazetteer(f, limit):
|
||||||
fcode = None
|
fcode = None
|
||||||
|
|
||||||
ft.feature_type = fcode
|
ft.feature_type = fcode
|
||||||
|
ft.admin1 = row[3]
|
||||||
|
ft.admin2 = row[4]
|
||||||
ft.geometry = Point(float(row[6]), float(row[5]))
|
ft.geometry = Point(float(row[6]), float(row[5]))
|
||||||
ft.save()
|
ft.save()
|
||||||
print "saved " + ft.preferred_name
|
print "saved " + ft.preferred_name
|
||||||
|
|
|
@ -16,6 +16,8 @@ class Feature(models.Model):
|
||||||
url = models.CharField(max_length=512, unique=True, verbose_name="URI")
|
url = models.CharField(max_length=512, unique=True, verbose_name="URI")
|
||||||
preferred_name = models.CharField(max_length=512)
|
preferred_name = models.CharField(max_length=512)
|
||||||
feature_type = models.ForeignKey("FeatureType", null=True, blank=True)
|
feature_type = models.ForeignKey("FeatureType", null=True, blank=True)
|
||||||
|
admin1 = models.CharField(max_length=2, blank=True)
|
||||||
|
admin2 = models.CharField(max_length=255, blank=True)
|
||||||
geometry = models.GeometryField()
|
geometry = models.GeometryField()
|
||||||
is_primary = models.BooleanField(default=True)
|
is_primary = models.BooleanField(default=True)
|
||||||
time_frame = models.ForeignKey("TimeFrame", null=True, blank=True)
|
time_frame = models.ForeignKey("TimeFrame", null=True, blank=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user