diff --git a/admin/views/chemistry_sampleinfo.py b/admin/views/chemistry_sampleinfo.py index d2179d4a..9aa6654e 100644 --- a/admin/views/chemistry_sampleinfo.py +++ b/admin/views/chemistry_sampleinfo.py @@ -28,6 +28,7 @@ - thing_id: Integer FK to Thing.id """ + from admin.views.base import OcotilloModelView @@ -38,22 +39,56 @@ class ChemistrySampleInfoAdmin(OcotilloModelView): # ========== Basic Configuration ========== - name = "Chemistry Sample Info" - label = "Chemistry Sample Info" + name = "NMA Chemistry Sample Info" + label = "NMA Chemistry Sample Info" icon = "fa fa-flask" # Integer PK pk_attr = "id" pk_type = int + def can_create(self, request: Request) -> bool: + return False + + def can_edit(self, request: Request) -> bool: + return False + + def can_delete(self, request: Request) -> bool: + return False + # ========== List View ========== - sortable_fields = [ + list_fields = [ "id", "nma_sample_pt_id", - "nma_object_id", + "nma_wclab_id", "nma_sample_point_id", + "nma_object_id", + "nma_location_id", + "thing_id", + HasOne("thing", identity="thing"), + "collection_date", + "collection_method", + "collected_by", + "analyses_agency", + "sample_type", + "sample_material_not_h2o", + "water_type", + "study_sample", + "data_source", + "data_quality", + "public_release", + "added_day_to_date", + "added_month_day_to_date", + "sample_notes", + ] + + sortable_fields = [ + "id", + "nma_sample_pt_id", "nma_wclab_id", + "nma_sample_point_id", + "nma_object_id", "collection_date", "sample_type", "data_source", @@ -64,13 +99,12 @@ class ChemistrySampleInfoAdmin(OcotilloModelView): fields_default_sort = [("collection_date", True)] searchable_fields = [ - "nma_sample_point_id", "nma_sample_pt_id", "nma_wclab_id", + "nma_sample_point_id", + "collection_date", "collected_by", "analyses_agency", - "sample_notes", - "collection_date", "sample_type", "sample_material_not_h2o", "water_type", @@ -78,6 +112,7 @@ class ChemistrySampleInfoAdmin(OcotilloModelView): "data_source", "data_quality", "public_release", + "sample_notes", ] page_size = 50 @@ -88,11 +123,12 @@ class ChemistrySampleInfoAdmin(OcotilloModelView): fields = [ "id", "nma_sample_pt_id", + "nma_wclab_id", "nma_sample_point_id", "nma_object_id", - "nma_wclab_id", "nma_location_id", "thing_id", + HasOne("thing", identity="thing"), "collection_date", "collection_method", "collected_by", @@ -109,22 +145,12 @@ class ChemistrySampleInfoAdmin(OcotilloModelView): "sample_notes", ] - exclude_fields_from_create = [ - "id", - "nma_object_id", - ] - - exclude_fields_from_edit = [ - "id", - "nma_object_id", - ] - field_labels = { "id": "ID", "nma_sample_pt_id": "NMA SamplePtID (Legacy)", + "nma_wclab_id": "NMA WCLab_ID (Legacy)", "nma_sample_point_id": "NMA SamplePointID (Legacy)", "nma_object_id": "NMA OBJECTID (Legacy)", - "nma_wclab_id": "NMA WCLab_ID (Legacy)", "nma_location_id": "NMA LocationId (Legacy)", "thing_id": "Thing ID", "collection_date": "Collection Date", @@ -132,7 +158,7 @@ class ChemistrySampleInfoAdmin(OcotilloModelView): "collected_by": "Collected By", "analyses_agency": "Analyses Agency", "sample_type": "Sample Type", - "sample_material_not_h2o": "Sample Material (Not H2O)", + "sample_material_not_h2o": "Sample Material Not H2O", "water_type": "Water Type", "study_sample": "Study Sample", "data_source": "Data Source", diff --git a/admin/views/thing.py b/admin/views/thing.py index db4a0914..e7c413fb 100644 --- a/admin/views/thing.py +++ b/admin/views/thing.py @@ -36,6 +36,7 @@ class ThingAdmin(OcotilloModelView): # ========== Basic Configuration ========== + identity = "thing" name = "Things" label = "Things (Wells/Springs)" icon = "fa fa-tint"