admin.py 465 Bytes
Newer Older
1
from django.contrib import admin
2
3
4
5
6
7
8
9
10
11
12
13
14

from django import forms
from .models import Specimen
from .widgets import LatLongWidget


# Custom form to provide lat/lon widget instead of OL map.
class MyAdminForm(forms.ModelForm):

    class Meta:
        model = Specimen
        fields = "__all__"
        widgets = {
15
            'coords': LatLongWidget
16
17
        }

18
19

class SpecimenAdmin(admin.ModelAdmin):
20
    form = MyAdminForm
21
22

admin.site.register(Specimen, SpecimenAdmin)