-
Notifications
You must be signed in to change notification settings - Fork 3
BDMS-493: Implement read-only admin view for NMAChemistry_SampleInfo #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jirhiker
merged 7 commits into
staging
from
kas-bdms-493-admin-view-NMAChemistrySampleInfo
Feb 4, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c4ea80
feat: enhance Chemistry Sample Info admin view with additional fields…
ksmuczynski 42cfb06
Update admin/views/chemistry_sampleinfo.py
ksmuczynski 4923ea2
Update admin/views/chemistry_sampleinfo.py
ksmuczynski 5410c4e
Formatting changes
ksmuczynski 240ae84
Apply suggestions from code review
jirhiker 23ec192
Formatting changes
jirhiker a2cd282
Update admin/views/chemistry_sampleinfo.py
jirhiker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,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 | ||
|
|
@@ -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,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", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.