some admin changes as per schuyler email

This commit is contained in:
Sanj 2011-08-24 18:38:09 +05:30
parent 5bda2ad896
commit 584afc94e7
5 changed files with 34 additions and 5 deletions

View File

@ -3,7 +3,7 @@ from models import *
class FeatureNamesInline(admin.StackedInline): class FeatureNamesInline(admin.StackedInline):
model = Name model = Name
extra = 3 extra = 0
class FeatureRelationInline(admin.TabularInline): class FeatureRelationInline(admin.TabularInline):
model = Feature.relationships.through model = Feature.relationships.through
@ -12,10 +12,10 @@ class FeatureRelationInline(admin.TabularInline):
class FeatureAdmin(admin.OSMGeoAdmin): 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_display = ('__unicode__', 'feature_type_name', 'time_start', 'time_end',) list_display = ('__unicode__', 'feature_type_name', 'time_start', 'time_end',)
list_per_page = 300 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
# map_template = 'gis/admin/osm.html' # map_template = 'gis/admin/osm.html'
@ -31,3 +31,4 @@ admin.site.register(Feature, FeatureAdmin)
admin.site.register(TimeFrame) admin.site.register(TimeFrame)
admin.site.register(FeatureType, FeatureTypeAdmin) admin.site.register(FeatureType, FeatureTypeAdmin)
admin.site.register(Relationship) admin.site.register(Relationship)
admin.site.register(AuthorityRecord)

View File

@ -11,6 +11,8 @@ ADMINS = (
INTERNAL_IPS = ('127.0.0.1',) INTERNAL_IPS = ('127.0.0.1',)
MANAGERS = ADMINS MANAGERS = ADMINS
PROJECT_ROOT = os.path.dirname(__file__)
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
@ -47,12 +49,12 @@ USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files. # Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/" # Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '' MEDIA_ROOT = join(PROJECT_ROOT, 'static')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a # URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases). # trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/" # Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '' MEDIA_URL = '/static/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash. # trailing slash.
@ -81,6 +83,7 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'gazetteer.urls' ROOT_URLCONF = 'gazetteer.urls'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
join(PROJECT_ROOT, 'templates'),
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows. # Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths. # Don't forget to use absolute paths, not relative paths.

View File

@ -0,0 +1,10 @@
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{{ title }} | {% trans 'Library of Congress Digital Gazetteer' %}{% endblock %}
{% block branding %}
<h1 id="site-name">{% trans 'Library of Congress Digital Gazetteer' %}</h1>
{% endblock %}
{% block nav-global %}{% endblock %}

View File

@ -0,0 +1,4 @@
{% extends "gis/admin/openlayers.html" %}
{% block openlayers %}
{% include "gis/admin/google.js" %}
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "gis/admin/openlayers.js" %}
{% block base_layer %}
new OpenLayers.Layer.Google("Google Terrain", {type: G_PHYSICAL_MAP, 'sphericalMercator': true});
{% endblock %}
{% block extra_layers %}
{{ module }}.layers.overlay = new OpenLayers.Layer.OSM.Mapnik("OpenStreetMap (Mapnik)");
{{ module }}.map.addLayer({{ module }}.layers.overlay);
{% endblock %}