diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/sketches/admin.py | 8 | ||||
-rw-r--r-- | app/sketches/models.py | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/sketches/admin.py b/app/sketches/admin.py index 9f3c087..41715aa 100644 --- a/app/sketches/admin.py +++ b/app/sketches/admin.py @@ -1,9 +1,10 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.contenttypes.admin import GenericTabularInline + from .models import Sketch from utils.widgets import LGEntryForm, OLAdminBase - +from utils.util import get_latlon @admin.register(Sketch) class SketchAdmin(OLAdminBase): @@ -27,6 +28,11 @@ class SketchAdmin(OLAdminBase): } ), ) + lat, lon = get_latlon() + default_lon = lon + default_lat = lat + default_zoom = 10 + class Media: js = ('image-loader.js',) diff --git a/app/sketches/models.py b/app/sketches/models.py index 22522bd..c7d28a5 100644 --- a/app/sketches/models.py +++ b/app/sketches/models.py @@ -25,6 +25,11 @@ class Sketch(models.Model): ) status = models.IntegerField(choices=PUB_STATUS, default=1) + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'sketches' + def __str__(self): return self.title |