form widget, etc. db change: ALTER TABLE 'places_timeframe' ALTER COLUMN 'description' TYPE varchar;

This commit is contained in:
Sanj 2011-08-25 02:33:25 +05:30
parent 584afc94e7
commit 4a5e61e2b0
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
from django.contrib.gis import admin from django.contrib.gis import admin
from models import * from models import *
from django import forms
class FeatureNamesInline(admin.StackedInline): class FeatureNamesInline(admin.StackedInline):
model = Name model = Name
@ -10,6 +11,17 @@ class FeatureRelationInline(admin.TabularInline):
extra = 1 extra = 1
fk_name = 'feature1' 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): class FeatureAdmin(admin.OSMGeoAdmin):
search_fields = ['preferred_name'] search_fields = ['preferred_name']
# list_filter = ('feature_type',) # list_filter = ('feature_type',)
@ -18,6 +30,7 @@ class FeatureAdmin(admin.OSMGeoAdmin):
list_per_page = 12 list_per_page = 12
openlayers_url = 'http://openlayers.org/dev/OpenLayers.js' openlayers_url = 'http://openlayers.org/dev/OpenLayers.js'
openlayers_img_path = None openlayers_img_path = None
form = featuresForm
# map_template = 'gis/admin/osm.html' # map_template = 'gis/admin/osm.html'
# default_lon = 72.855211097628413 # default_lon = 72.855211097628413
# default_lat = 19.415775291486027 # default_lat = 19.415775291486027

View File

@ -13,7 +13,7 @@ class AuthorityRecord(models.Model):
class Feature(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) 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)
geometry = models.GeometryField() geometry = models.GeometryField()
@ -79,7 +79,7 @@ GRANULARITY_CHOICES = (
) )
class TimeFrame(models.Model): class TimeFrame(models.Model):
description = models.TextField(blank=True) description = models.CharField(max_length=100, blank=True)
start_date = models.DateField() start_date = models.DateField()
end_date = models.DateField() #add default to now end_date = models.DateField() #add default to now
start_granularity = models.CharField(max_length=64, choices=GRANULARITY_CHOICES) start_granularity = models.CharField(max_length=64, choices=GRANULARITY_CHOICES)