added list_display fields in admin; show only 300 features per page, not 500
This commit is contained in:
parent
715fe5ccf1
commit
9697290f95
|
@ -14,7 +14,8 @@ 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_per_page = 500
|
list_display = ('__unicode__', 'feature_type_name', 'time_start', 'time_end',)
|
||||||
|
list_per_page = 300
|
||||||
openlayers_url = 'http://openlayers.org/dev/OpenLayers.js'
|
openlayers_url = 'http://openlayers.org/dev/OpenLayers.js'
|
||||||
openlayers_img_path = None
|
openlayers_img_path = None
|
||||||
# map_template = 'gis/admin/osm.html'
|
# map_template = 'gis/admin/osm.html'
|
||||||
|
@ -23,7 +24,10 @@ class FeatureAdmin(admin.OSMGeoAdmin):
|
||||||
# default_zoom = 4
|
# default_zoom = 4
|
||||||
# extra_js = ['http://openstreetmap.org/openlayers/OpenStreetMap.js']
|
# extra_js = ['http://openstreetmap.org/openlayers/OpenStreetMap.js']
|
||||||
|
|
||||||
|
class FeatureTypeAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('code', 'name', 'description', 'feature_class',)
|
||||||
|
|
||||||
admin.site.register(Feature, FeatureAdmin)
|
admin.site.register(Feature, FeatureAdmin)
|
||||||
admin.site.register(TimeFrame)
|
admin.site.register(TimeFrame)
|
||||||
admin.site.register(FeatureType)
|
admin.site.register(FeatureType, FeatureTypeAdmin)
|
||||||
admin.site.register(Relationship)
|
admin.site.register(Relationship)
|
||||||
|
|
|
@ -28,6 +28,25 @@ class Feature(models.Model):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.preferred_name
|
return self.preferred_name
|
||||||
|
|
||||||
|
def feature_type_name(self):
|
||||||
|
return "%s: %s" % (self.feature_type.code, self.feature_type.name,)
|
||||||
|
feature_type_name.description = "Feature Type"
|
||||||
|
|
||||||
|
def time_start(self):
|
||||||
|
tf = self.time_frame
|
||||||
|
if tf is not None:
|
||||||
|
return str(tf.start_date)
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
time_start.description = "Start Date"
|
||||||
|
|
||||||
|
def time_end(self):
|
||||||
|
tf = self.time_frame
|
||||||
|
if tf is not None:
|
||||||
|
return str(tf.end_sate)
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
time_end.description = "End Date"
|
||||||
|
|
||||||
|
|
||||||
LANGUAGE_CHOICES = (
|
LANGUAGE_CHOICES = (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user