summaryrefslogtreecommitdiff
path: root/app/sightings/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/sightings/admin.py')
-rw-r--r--app/sightings/admin.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/app/sightings/admin.py b/app/sightings/admin.py
index d95dd72..fcbc2ca 100644
--- a/app/sightings/admin.py
+++ b/app/sightings/admin.py
@@ -1,7 +1,7 @@
import copy
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
-from .models import APClass, AP, Sighting
+from .models import APClass, AP, Sighting, FieldNote
from photos.forms import GalleryForm
from utils.util import get_latlon
@@ -96,3 +96,35 @@ class SightingAdmin(OSMGeoAdmin):
class Media:
js = ('next-prev-links.js',)
+
+@admin.register(FieldNote)
+class FieldNoteAdmin(admin.ModelAdmin):
+ form = LGEntryForm
+
+ def get_form(self, request, obj=None, **kwargs):
+ form = super(FieldNoteAdmin, self).get_form(request, obj, **kwargs)
+ form.base_fields['sighting'].label_from_instance = lambda obj: "{} - {} - {}".format(obj.ap_common_name, obj.pub_date.strftime("%Y-%b-%d"), obj.location_name)
+ return form
+
+ list_display = ('pk', 'ap_common_name', 'sighting_pub_date', 'sighting_location')
+ fieldsets = (
+ ('', {
+ 'fields': (
+ 'sighting',
+ 'body_markdown',
+ ),
+ 'classes': (
+ 'show',
+ 'extrapretty',
+ 'wide'
+ )
+ }
+ ),
+ )
+
+ class Media:
+ js = ('image-loader.js', 'next-prev-links.js')
+ css = {
+ "all": ("my_styles.css",)
+ }
+