summaryrefslogtreecommitdiff
path: root/app/notes/admin.py
blob: 8797a92ed4fc67b9f7f73fdceed1fce0de4ef499 (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
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
from notes.models import Note
from django import forms


class NoteModelForm(forms.ModelForm):
    body_markdown = forms.CharField(widget=forms.Textarea(attrs={'maxlength': 400, 'rows': 5, 'cols': 65}), label='Note')

    class Meta:
        model = Note


class NoteAdmin(OSMGeoAdmin):
    form = NoteModelForm
    list_display = ('slug', 'date_created', 'location')
    list_filter = ('location',)
    fieldsets = (
        ('Note', {
            'fields': (
                'body_markdown',
                '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)