From 584afc94e77825d1b922e9127144fc468a33fb1f Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 24 Aug 2011 18:38:09 +0530 Subject: [PATCH] some admin changes as per schuyler email --- gazetteer/places/admin.py | 7 ++++--- gazetteer/settings.py | 7 +++++-- gazetteer/templates/admin/base_site.html | 10 ++++++++++ gazetteer/templates/gis/admin/google.html | 4 ++++ gazetteer/templates/gis/admin/google.js | 11 +++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 gazetteer/templates/admin/base_site.html create mode 100644 gazetteer/templates/gis/admin/google.html create mode 100644 gazetteer/templates/gis/admin/google.js diff --git a/gazetteer/places/admin.py b/gazetteer/places/admin.py index 422baca..05a75e5 100644 --- a/gazetteer/places/admin.py +++ b/gazetteer/places/admin.py @@ -3,7 +3,7 @@ from models import * class FeatureNamesInline(admin.StackedInline): model = Name - extra = 3 + extra = 0 class FeatureRelationInline(admin.TabularInline): model = Feature.relationships.through @@ -12,10 +12,10 @@ class FeatureRelationInline(admin.TabularInline): class FeatureAdmin(admin.OSMGeoAdmin): search_fields = ['preferred_name'] - list_filter = ('feature_type',) +# list_filter = ('feature_type',) inlines = [FeatureNamesInline] 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_img_path = None # map_template = 'gis/admin/osm.html' @@ -31,3 +31,4 @@ admin.site.register(Feature, FeatureAdmin) admin.site.register(TimeFrame) admin.site.register(FeatureType, FeatureTypeAdmin) admin.site.register(Relationship) +admin.site.register(AuthorityRecord) diff --git a/gazetteer/settings.py b/gazetteer/settings.py index c228104..65b6478 100644 --- a/gazetteer/settings.py +++ b/gazetteer/settings.py @@ -11,6 +11,8 @@ ADMINS = ( INTERNAL_IPS = ('127.0.0.1',) MANAGERS = ADMINS +PROJECT_ROOT = os.path.dirname(__file__) + DATABASES = { 'default': { '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. # 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 # trailing slash if there is a path component (optional in other cases). # 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 # trailing slash. @@ -81,6 +83,7 @@ MIDDLEWARE_CLASSES = ( ROOT_URLCONF = 'gazetteer.urls' TEMPLATE_DIRS = ( + join(PROJECT_ROOT, 'templates'), # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. diff --git a/gazetteer/templates/admin/base_site.html b/gazetteer/templates/admin/base_site.html new file mode 100644 index 0000000..0fb4090 --- /dev/null +++ b/gazetteer/templates/admin/base_site.html @@ -0,0 +1,10 @@ +{% extends "admin/base.html" %} +{% load i18n %} + +{% block title %}{{ title }} | {% trans 'Library of Congress Digital Gazetteer' %}{% endblock %} + +{% block branding %} +

{% trans 'Library of Congress Digital Gazetteer' %}

+{% endblock %} + +{% block nav-global %}{% endblock %} diff --git a/gazetteer/templates/gis/admin/google.html b/gazetteer/templates/gis/admin/google.html new file mode 100644 index 0000000..1134839 --- /dev/null +++ b/gazetteer/templates/gis/admin/google.html @@ -0,0 +1,4 @@ +{% extends "gis/admin/openlayers.html" %} +{% block openlayers %} +{% include "gis/admin/google.js" %} +{% endblock %} diff --git a/gazetteer/templates/gis/admin/google.js b/gazetteer/templates/gis/admin/google.js new file mode 100644 index 0000000..ed9090d --- /dev/null +++ b/gazetteer/templates/gis/admin/google.js @@ -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 %} + +