From 10d4e70648f070246a38e0308694415107f4c1bd Mon Sep 17 00:00:00 2001 From: Sanj Date: Sun, 28 Aug 2011 01:14:19 +0530 Subject: [PATCH] add admin1 and admin2 to Feature (models, admin and imports) --- gazetteer/places/admin.py | 2 +- gazetteer/places/imports.py | 2 ++ gazetteer/places/models.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gazetteer/places/admin.py b/gazetteer/places/admin.py index f43db00..db0ead3 100644 --- a/gazetteer/places/admin.py +++ b/gazetteer/places/admin.py @@ -64,7 +64,7 @@ class FeatureAdmin(admin.OSMGeoAdmin): search_fields = ['preferred_name'] # list_filter = ('feature_type',) 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_filter = (FeatureTypeFilter,) openlayers_url = 'http://openlayers.org/dev/OpenLayers.js' diff --git a/gazetteer/places/imports.py b/gazetteer/places/imports.py index d91e729..c38b44e 100644 --- a/gazetteer/places/imports.py +++ b/gazetteer/places/imports.py @@ -36,6 +36,8 @@ def import_gazetteer(f, limit): fcode = None ft.feature_type = fcode + ft.admin1 = row[3] + ft.admin2 = row[4] ft.geometry = Point(float(row[6]), float(row[5])) ft.save() print "saved " + ft.preferred_name diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index a1079ba..61fd922 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -16,6 +16,8 @@ class Feature(models.Model): url = models.CharField(max_length=512, unique=True, verbose_name="URI") preferred_name = models.CharField(max_length=512) 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() is_primary = models.BooleanField(default=True) time_frame = models.ForeignKey("TimeFrame", null=True, blank=True)