diff options
author | luxagraf <sng@luxagraf.net> | 2016-01-27 19:02:19 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2016-01-27 19:02:19 -0500 |
commit | 84e4e4876890d3eb670c76ccdb5111741a95c315 (patch) | |
tree | 4a27f9aa3f4fdfb1873bdd552b1fd233fe2738fd /app | |
parent | 45b7cf38679a55201acf066dc362e1e1c4fcbc9b (diff) |
created a generic geoadmin class with some sane defaults and eliminated
a non TLS file in admin
Diffstat (limited to 'app')
-rw-r--r-- | app/daily/admin.py | 24 | ||||
-rw-r--r-- | app/utils/widgets.py | 13 |
2 files changed, 20 insertions, 17 deletions
diff --git a/app/daily/admin.py b/app/daily/admin.py index 704d0dc..b61a2ad 100644 --- a/app/daily/admin.py +++ b/app/daily/admin.py @@ -1,15 +1,18 @@ from django.contrib import admin -from django.contrib.gis.admin import OSMGeoAdmin -from utils.widgets import LGEntryForm +from utils.widgets import LGEntryForm, OLAdminBase from .models import CheckIn, Daily, Weather -class WeatherAdmin(OSMGeoAdmin): +class WeatherAdmin(OLAdminBase): pass -class DailyAdmin(OSMGeoAdmin): +class CheckInAdmin(OLAdminBase): + pass + + +class DailyAdmin(admin.ModelAdmin): form = LGEntryForm list_display = ('date', 'user', 'location') list_filter = ( @@ -46,19 +49,6 @@ class DailyAdmin(OSMGeoAdmin): return qs.filter(user=request.user) -class CheckInAdmin(OSMGeoAdmin): - list_display = ('date', 'location') - default_lon = -9285175 - default_lat = 4025046 - default_zoom = 15 - units = True - scrollable = False - map_width = 700 - map_height = 425 - map_template = 'gis/admin/osm.html' - openlayers_url = '/static/admin/js/OpenLayers.js' - - admin.site.register(CheckIn, CheckInAdmin) admin.site.register(Weather, WeatherAdmin) admin.site.register(Daily, DailyAdmin) diff --git a/app/utils/widgets.py b/app/utils/widgets.py index 90a0505..6d6a334 100644 --- a/app/utils/widgets.py +++ b/app/utils/widgets.py @@ -2,6 +2,7 @@ import os from django import forms from django.contrib import admin from django.contrib.admin.widgets import AdminFileWidget +from django.contrib.gis.admin import OSMGeoAdmin from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.conf import settings @@ -91,3 +92,15 @@ class LGEntryForm(forms.ModelForm): widgets = { 'body_markdown': forms.Textarea(attrs={'rows': 50, 'cols': 100}), } + + +class OLAdminBase(OSMGeoAdmin): + default_lon = -9285175 + default_lat = 4025046 + default_zoom = 15 + units = True + scrollable = False + map_width = 700 + map_height = 425 + map_template = 'gis/admin/osm.html' + openlayers_url = '/static/admin/js/OpenLayers.js' |