Skip to content

Commit d326dd0

Browse files
[views/weather_data] Create WeatherDataAdmin pg
1 parent 988cb63 commit d326dd0

3 files changed

Lines changed: 59 additions & 0 deletions

File tree

admin/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
SurfaceWaterDataAdmin,
5151
ThingAdmin,
5252
TransducerObservationAdmin,
53+
WeatherDataAdmin,
5354
)
5455
from db.asset import Asset
5556
from db.aquifer_system import AquiferSystem
@@ -71,6 +72,7 @@
7172
SoilRockResults,
7273
Stratigraphy,
7374
SurfaceWaterData,
75+
WeatherData,
7476
)
7577
from db.notes import Notes
7678
from db.observation import Observation
@@ -174,6 +176,9 @@ def create_admin(app):
174176
# SoilRockResults
175177
admin.add_view(SoilRockResultsAdmin(SoilRockResults))
176178

179+
# Weather
180+
admin.add_view(WeatherDataAdmin(WeatherData))
181+
177182
# Future: Add more views here as they are implemented
178183
# admin.add_view(SampleAdmin)
179184
# admin.add_view(GroupAdmin)

admin/views/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from admin.views.surface_water import SurfaceWaterDataAdmin
4949
from admin.views.thing import ThingAdmin
5050
from admin.views.transducer_observation import TransducerObservationAdmin
51+
from admin.views.weather_data import WeatherDataAdmin
5152

5253
__all__ = [
5354
"AssetAdmin",
@@ -78,4 +79,5 @@
7879
"SurfaceWaterDataAdmin",
7980
"ThingAdmin",
8081
"TransducerObservationAdmin",
82+
"WeatherDataAdmin",
8183
]

admin/views/weather_data.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from admin.views.base import OcotilloModelView
2+
3+
4+
class WeatherDataAdmin(OcotilloModelView):
5+
"""
6+
Admin view for legacy WeatherData model (NMA_WeatherData).
7+
"""
8+
9+
# ========== Basic Configuration ==========
10+
name = "NMA Weather Data"
11+
label = "NMA Weather Data"
12+
icon = "fa fa-cloud-sun"
13+
14+
# Pagination
15+
page_size = 50
16+
page_size_options = [25, 50, 100, 200]
17+
18+
# ========== List View ==========
19+
list_fields = [
20+
"location_id",
21+
"point_id",
22+
"weather_id",
23+
"object_id",
24+
]
25+
26+
sortable_fields = [
27+
"object_id",
28+
"point_id",
29+
]
30+
31+
fields_default_sort = [("point_id", False), ("object_id", False)]
32+
33+
searchable_fields = [
34+
"point_id",
35+
"weather_id",
36+
]
37+
38+
# ========== Detail View ==========
39+
fields = [
40+
"location_id",
41+
"point_id",
42+
"weather_id",
43+
"object_id",
44+
]
45+
46+
# ========== Legacy Field Labels ==========
47+
field_labels = {
48+
"location_id": "LocationId",
49+
"point_id": "PointID",
50+
"weather_id": "WeatherID",
51+
"object_id": "OBJECTID",
52+
}

0 commit comments

Comments
 (0)