forked from lseroka/SI664-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
heritagesites_admin.py
117 lines (91 loc) · 2.33 KB
/
heritagesites_admin.py
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from django.contrib import admin
import heritagesites.models as models
@admin.register(models.CountryArea)
class CountryAreaAdmin(admin.ModelAdmin):
fields = [
'country_area_name',
(
'region',
'sub_region',
'intermediate_region'
),
'iso_alpha3_code',
'm49_code',
'dev_status'
]
list_display = [
'country_area_name',
'region',
'sub_region',
'intermediate_region',
'iso_alpha3_code',
'm49_code',
'dev_status'
]
list_filter = ['region', 'sub_region', 'intermediate_region', 'dev_status']
# admin.site.register(models.CountryArea)
@admin.register(models.DevStatus)
class DevStatusAdmin(admin.ModelAdmin):
fields = ['dev_status_name']
list_display = ['dev_status_name']
ordering = ['dev_status_name']
# admin.site.register(models.DevStatus)
@admin.register(models.HeritageSite)
class HeritageSiteAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': (
'site_name',
'heritage_site_category',
'description',
'justification',
'date_inscribed'
)
}),
('Location and Area', {
'fields': [
(
'longitude',
'latitude'
),
'area_hectares',
'transboundary'
]
})
)
list_display = (
'site_name',
'date_inscribed',
'area_hectares',
'heritage_site_category',
'country_area_display'
)
list_filter = (
'heritage_site_category',
'date_inscribed'
)
# admin.site.register(models.HeritageSite)
@admin.register(models.HeritageSiteCategory)
class HeritageSiteCategoryAdmin(admin.ModelAdmin):
fields = ['category_name']
list_display = ['category_name']
ordering = ['category_name']
# admin.site.register(models.HeritageSiteCategory)
@admin.register(models.IntermediateRegion)
class IntermediateRegionAdmin(admin.ModelAdmin):
fields = ['intermediate_region_name', 'sub_region']
list_display = ['intermediate_region_name', 'sub_region']
ordering = ['intermediate_region_name']
# admin.site.register(models.IntermediateRegion)
@admin.register(models.Region)
class RegionAdmin(admin.ModelAdmin):
fields = ['region_name']
list_display = ['region_name']
ordering = ['region_name']
# admin.site.register(models.Region)
@admin.register(models.SubRegion)
class SubRegionAdmin(admin.ModelAdmin):
fields = ['sub_region_name', 'region']
list_display = ['sub_region_name', 'region']
ordering = ['sub_region_name']
# admin.site.register(models.SubRegion)