Skip to content

Commit

Permalink
fix: retrieve ELISAs by cohort pk, not library
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Mar 12, 2024
1 parent ca82dca commit 334cd7d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/antigenapi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class ElisaPlateViewSet(AuditLogMixin, DeleteProtectionMixin, ModelViewSet):

queryset = ElisaPlate.objects.all().select_related("library__cohort")
serializer_class = ElisaPlateSerializer
filterset_fields = ("library",)
filterset_fields = ("library", "library__cohort")

def perform_create(self, serializer): # noqa: D102
serializer.save(added_by=self.request.user)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ const App = () => {
<ListTable
tabName="Elisas"
schema={schemas.elisa}
filterField="library__cohort"
onSetError={setError}
readOnly={true}
></ListTable>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/crudtemplates/ListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const ListTable = (props) => {
useEffect(() => {
const refreshRecords = () => {
let schemaUrl = config.url.API_URL + props.schema.apiUrl + "/";
if (props.schema.parentObjectName) {
if (props.filterField) {
schemaUrl += "?" + props.filterField + "=" + recordId;
} else if (props.schema.parentObjectName) {
schemaUrl += "?" + props.schema.parentObjectName + "=" + recordId;
}
fetch(schemaUrl, {
Expand Down

0 comments on commit 334cd7d

Please sign in to comment.