Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 46 additions & 20 deletions admin/views/chemistry_sampleinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- thing_id: Integer FK to Thing.id
"""


from admin.views.base import OcotilloModelView


Expand All @@ -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
Comment on lines +50 to +57
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Request type is referenced but not imported. Add 'from starlette.requests import Request' or the appropriate request type import for this codebase.

Copilot uses AI. Check for mistakes.

# ========== 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"),
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HasOne class is referenced but not imported. Add the appropriate import statement for HasOne at the top of the file.

Copilot uses AI. Check for mistakes.
"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",
Expand All @@ -64,20 +99,20 @@ 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",
"study_sample",
"data_source",
"data_quality",
"public_release",
"sample_notes",
]

page_size = 50
Expand All @@ -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",
Expand All @@ -109,30 +145,20 @@ 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",
"collection_method": "Collection Method",
"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",
Expand Down
1 change: 1 addition & 0 deletions admin/views/thing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ThingAdmin(OcotilloModelView):

# ========== Basic Configuration ==========

identity = "thing"
name = "Things"
label = "Things (Wells/Springs)"
icon = "fa fa-tint"
Expand Down
Loading