summaryrefslogtreecommitdiff
path: root/app/unused_apps/guides/admin.py
blob: 7895abab1dc6cd01363eb0a5b73e2be0b45725e8 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin

from utils.widgets import LGEntryForm
from utils.util import get_latlon

from .models import Guide


@admin.register(Guide)
class GuideAdmin(OSMGeoAdmin):
    form = LGEntryForm
    list_display = ('title', 'pub_date', 'enable_comments', 'status', 'post_type')
    list_filter = ('pub_date', 'enable_comments', 'status')
    prepopulated_fields = {"slug": ('title',)}
    fieldsets = (
        ('Entry', {
            'fields': (
                'title',
                'sub_title',
                'body_markdown',
                ('pub_date', 'status', 'post_type', 'disclaimer'),
                'meta_description',
                'featured_image',
                'dek',
                'tags',
                'prologue_markdown',
                'epilogue_markdown',
                'has_video',
                ('slug', 'enable_comments'),
                'point',
            ),
            'classes': (
                'show',
                'extrapretty',
                'wide'
            )
        }),
        ('meta', {
            'fields': (
                ('field_notes', 'books','jrnl'),
            ),
            'classes': (
                'hide',
                'extrapretty',
                'wide'
            )
        }),
    )

    # options for OSM map Using custom ESRI topo map
    lat, lon = get_latlon()
    default_lon = lon
    default_lat = lat
    default_zoom = 10
    units = True
    scrollable = False
    map_width = 700
    map_height = 425
    map_template = 'gis/admin/osm.html'
    openlayers_url = '/static/admin/js/OpenLayers.js'

    class Media:
        js = ('image-loader.js', 'next-prev-links.js')
        css = {
            "all": ("my_styles.css",)
        }