Skip to content

Commit

Permalink
add sample detail in staff
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Jan 15, 2025
1 parent e505775 commit d954adc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/genlab_bestilling/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,11 @@ def __str__(self):

class Sample(models.Model):
order = models.ForeignKey(
"ExtractionOrder", on_delete=models.CASCADE, related_name="samples"
"ExtractionOrder",
on_delete=models.CASCADE,
related_name="samples",
null=True,
blank=True,
)
guid = models.CharField(max_length=200, null=True, blank=True)
name = models.CharField(null=True, blank=True)
Expand Down Expand Up @@ -553,6 +557,9 @@ class ExtractionPlate(models.Model):
# freezer
# shelf

def __str__(self):
return f"#P{self.id}" + f" - {self.name}" if self.name else ""


class AnalysisResult(models.Model):
name = models.CharField()
Expand Down
6 changes: 6 additions & 0 deletions src/genlab_bestilling/staff/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ def render_sample__plate_positions(self, value):


class SampleTable(SampleBaseTable):
genlab_id = tables.Column(
linkify=("staff:samples-detail", {"pk": tables.A("id")}),
orderable=False,
empty_values=(),
)

class Meta(SampleBaseTable.Meta):
fields = SampleBaseTable.Meta.fields + (
"order",
Expand Down
15 changes: 15 additions & 0 deletions src/genlab_bestilling/staff/templates/staff/sample_detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends "staff/base.html" %}
{% load i18n %}


{% block content %}
<h3 class="text-4xl mb-5">Sample {{ object }}</h3>
<div class="flex gap-5 mb-5">
</div>

{% object-detail object=object %}

<div class="flex gap-5 my-5">
<a class="btn bg-yellow-200" href="{% url 'staff:samples-list' %}"><i class="fas fa-arrow-left"></i> back</a>
</div>
{% endblock %}
6 changes: 6 additions & 0 deletions src/genlab_bestilling/staff/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
OrderExtractionSamplesListView,
OrderToDraftActionView,
OrderToNextStatusActionView,
SampleDetailView,
SamplesListView,
)

Expand Down Expand Up @@ -71,6 +72,11 @@
SamplesListView.as_view(),
name="samples-list",
),
path(
"samples/<int:pk>/",
SampleDetailView.as_view(),
name="samples-detail",
),
path(
"orders/equipment/<int:pk>/",
EquipmentOrderDetailView.as_view(),
Expand Down
4 changes: 4 additions & 0 deletions src/genlab_bestilling/staff/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ def get_queryset(self):
)


class SampleDetailView(StaffMixin, DetailView):
model = Sample


class ManaullyCheckedOrderActionView(SingleObjectMixin, ActionView):
model = ExtractionOrder

Expand Down

0 comments on commit d954adc

Please sign in to comment.