2828- thing_id: Integer FK to Thing.id
2929"""
3030
31+
3132from admin .views .base import OcotilloModelView
3233
3334
@@ -38,22 +39,56 @@ class ChemistrySampleInfoAdmin(OcotilloModelView):
3839
3940 # ========== Basic Configuration ==========
4041
41- name = "Chemistry Sample Info"
42- label = "Chemistry Sample Info"
42+ name = "NMA Chemistry Sample Info"
43+ label = "NMA Chemistry Sample Info"
4344 icon = "fa fa-flask"
4445
4546 # Integer PK
4647 pk_attr = "id"
4748 pk_type = int
4849
50+ def can_create (self , request : Request ) -> bool :
51+ return False
52+
53+ def can_edit (self , request : Request ) -> bool :
54+ return False
55+
56+ def can_delete (self , request : Request ) -> bool :
57+ return False
58+
4959 # ========== List View ==========
5060
51- sortable_fields = [
61+ list_fields = [
5262 "id" ,
5363 "nma_sample_pt_id" ,
54- "nma_object_id " ,
64+ "nma_wclab_id " ,
5565 "nma_sample_point_id" ,
66+ "nma_object_id" ,
67+ "nma_location_id" ,
68+ "thing_id" ,
69+ HasOne ("thing" , identity = "thing" ),
70+ "collection_date" ,
71+ "collection_method" ,
72+ "collected_by" ,
73+ "analyses_agency" ,
74+ "sample_type" ,
75+ "sample_material_not_h2o" ,
76+ "water_type" ,
77+ "study_sample" ,
78+ "data_source" ,
79+ "data_quality" ,
80+ "public_release" ,
81+ "added_day_to_date" ,
82+ "added_month_day_to_date" ,
83+ "sample_notes" ,
84+ ]
85+
86+ sortable_fields = [
87+ "id" ,
88+ "nma_sample_pt_id" ,
5689 "nma_wclab_id" ,
90+ "nma_sample_point_id" ,
91+ "nma_object_id" ,
5792 "collection_date" ,
5893 "sample_type" ,
5994 "data_source" ,
@@ -64,20 +99,20 @@ class ChemistrySampleInfoAdmin(OcotilloModelView):
6499 fields_default_sort = [("collection_date" , True )]
65100
66101 searchable_fields = [
67- "nma_sample_point_id" ,
68102 "nma_sample_pt_id" ,
69103 "nma_wclab_id" ,
104+ "nma_sample_point_id" ,
105+ "collection_date" ,
70106 "collected_by" ,
71107 "analyses_agency" ,
72- "sample_notes" ,
73- "collection_date" ,
74108 "sample_type" ,
75109 "sample_material_not_h2o" ,
76110 "water_type" ,
77111 "study_sample" ,
78112 "data_source" ,
79113 "data_quality" ,
80114 "public_release" ,
115+ "sample_notes" ,
81116 ]
82117
83118 page_size = 50
@@ -88,11 +123,12 @@ class ChemistrySampleInfoAdmin(OcotilloModelView):
88123 fields = [
89124 "id" ,
90125 "nma_sample_pt_id" ,
126+ "nma_wclab_id" ,
91127 "nma_sample_point_id" ,
92128 "nma_object_id" ,
93- "nma_wclab_id" ,
94129 "nma_location_id" ,
95130 "thing_id" ,
131+ HasOne ("thing" , identity = "thing" ),
96132 "collection_date" ,
97133 "collection_method" ,
98134 "collected_by" ,
@@ -109,30 +145,20 @@ class ChemistrySampleInfoAdmin(OcotilloModelView):
109145 "sample_notes" ,
110146 ]
111147
112- exclude_fields_from_create = [
113- "id" ,
114- "nma_object_id" ,
115- ]
116-
117- exclude_fields_from_edit = [
118- "id" ,
119- "nma_object_id" ,
120- ]
121-
122148 field_labels = {
123149 "id" : "ID" ,
124150 "nma_sample_pt_id" : "NMA SamplePtID (Legacy)" ,
151+ "nma_wclab_id" : "NMA WCLab_ID (Legacy)" ,
125152 "nma_sample_point_id" : "NMA SamplePointID (Legacy)" ,
126153 "nma_object_id" : "NMA OBJECTID (Legacy)" ,
127- "nma_wclab_id" : "NMA WCLab_ID (Legacy)" ,
128154 "nma_location_id" : "NMA LocationId (Legacy)" ,
129155 "thing_id" : "Thing ID" ,
130156 "collection_date" : "Collection Date" ,
131157 "collection_method" : "Collection Method" ,
132158 "collected_by" : "Collected By" ,
133159 "analyses_agency" : "Analyses Agency" ,
134160 "sample_type" : "Sample Type" ,
135- "sample_material_not_h2o" : "Sample Material ( Not H2O) " ,
161+ "sample_material_not_h2o" : "Sample Material Not H2O" ,
136162 "water_type" : "Water Type" ,
137163 "study_sample" : "Study Sample" ,
138164 "data_source" : "Data Source" ,
0 commit comments