summaryrefslogtreecommitdiff
path: root/app/notes/admin.py
blob: dcd357664adc7bc583a3b04d01b12187e011808b (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
68
69
70
71
72
73
74
75
76
77
78
79
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
from django.contrib.contenttypes.admin import GenericTabularInline
from notes.models import Note, LuxNote
from syndication.models import SyndicatedItem
from utils.widgets import LGEntryForm, OLAdminBase


class SyndicatedInline(GenericTabularInline):
    model = SyndicatedItem
    extra = 1
    max_num = 1


class LuxNoteAdmin(OLAdminBase):
    inlines = [
        SyndicatedInline,

    ]
    prepopulated_fields = {"slug": ('title',)}
    list_display = ('slug', 'pub_date', 'location')
    fieldsets = (
        ('Note', {
            'fields': (
                ('title', 'slug'),
                'body_markdown',
                ('pub_date', 'status'),
                'point'
            ),
            'classes': (
                'show',
                'extrapretty',
                'wide'
            )
        }
        ),
    )


admin.site.register(LuxNote, LuxNoteAdmin)


class NoteAdmin(OSMGeoAdmin):
    form = LGEntryForm
    list_display = ('slug', 'date_created', 'location', 'twitter_id')
    list_filter = ('location',)
    prepopulated_fields = {"slug": ('title',)}
    fieldsets = (
        ('Note', {
            'fields': (
                'title',
                'body_markdown',
                ('twitter_send', 'slug'),
                'point'
            ),
            'classes': (
                'show',
                'extrapretty',
                'wide'
            )
        }),
    )
    # options for OSM map Using custom ESRI topo map
    default_lon = -9285175
    default_lat = 4025046
    default_zoom = 11
    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 = (
            '/static/jquery.simplyCountable.js',
            '/static/count.js',
        )
admin.site.register(Note, NoteAdmin)