summaryrefslogtreecommitdiff
path: root/app/fieldnotes/admin.py
blob: 838063dc5479d8fa42287beb987f1b46b002f00d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline

from .models import FieldNote
from utils.widgets import LGEntryForm, OLAdminBase
from utils.util import get_latlon


@admin.register(FieldNote)
class NoteAdmin(OLAdminBase):
    form = LGEntryForm
    prepopulated_fields = {"slug": ('title',)}
    list_display = ('title', 'slug', 'pub_date', 'location')
    fieldsets = (
        ('Note', {
            'fields': (
                ('title', 'note_type'),
                'subtitle',
                'body_markdown',
                'slug',
                ('pub_date', 'status'),
                'point'
            ),
            'classes': (
                'show',
                'extrapretty',
                'wide'
            )
        }
        ),
    )
    lat, lon = get_latlon()
    default_lon = lon
    default_lat = lat
    default_zoom = 10

    class Media:
        js = ('image-loader.js', 'next-prev-links.js')