add admin1 and admin2 to Feature (models, admin and imports)

This commit is contained in:
Sanj 2011-08-28 01:14:19 +05:30
parent 147a5d57f5
commit 10d4e70648
3 changed files with 5 additions and 1 deletions

View File

@ -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'

View File

@ -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

View File

@ -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)