From 4a5e61e2b01aed794bc8e90a4661ace470dae37a Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 25 Aug 2011 02:33:25 +0530 Subject: [PATCH] form widget, etc. db change: ALTER TABLE 'places_timeframe' ALTER COLUMN 'description' TYPE varchar; --- gazetteer/places/admin.py | 13 +++++++++++++ gazetteer/places/models.py | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gazetteer/places/admin.py b/gazetteer/places/admin.py index 05a75e5..26334ab 100644 --- a/gazetteer/places/admin.py +++ b/gazetteer/places/admin.py @@ -1,5 +1,6 @@ from django.contrib.gis import admin from models import * +from django import forms class FeatureNamesInline(admin.StackedInline): model = Name @@ -10,6 +11,17 @@ class FeatureRelationInline(admin.TabularInline): extra = 1 fk_name = 'feature1' + +class featuresForm(forms.ModelForm): + url = forms.CharField(label='URI', + required=True, + widget=forms.TextInput(attrs={'size': '40'})) +# exclude = ('info',) + + class Meta: + model = Feature + + class FeatureAdmin(admin.OSMGeoAdmin): search_fields = ['preferred_name'] # list_filter = ('feature_type',) @@ -18,6 +30,7 @@ class FeatureAdmin(admin.OSMGeoAdmin): list_per_page = 12 openlayers_url = 'http://openlayers.org/dev/OpenLayers.js' openlayers_img_path = None + form = featuresForm # map_template = 'gis/admin/osm.html' # default_lon = 72.855211097628413 # default_lat = 19.415775291486027 diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index 828aa87..a1079ba 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -13,7 +13,7 @@ class AuthorityRecord(models.Model): class Feature(models.Model): - url = models.CharField(max_length=512, unique=True) + 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) geometry = models.GeometryField() @@ -79,7 +79,7 @@ GRANULARITY_CHOICES = ( ) class TimeFrame(models.Model): - description = models.TextField(blank=True) + description = models.CharField(max_length=100, blank=True) start_date = models.DateField() end_date = models.DateField() #add default to now start_granularity = models.CharField(max_length=64, choices=GRANULARITY_CHOICES)