Fix names to make all the things work.
Need to use 'yeast' instead of 'sample' to keep thing consistent for the label generator.
This commit is contained in:
parent
f59ec40958
commit
c4d9d9489d
@ -19,7 +19,6 @@
|
||||
<p><p>
|
||||
|
||||
</div> <!-- /container -->
|
||||
{% url 'yeast:labels' batch.id %}
|
||||
<div class="container">
|
||||
<form action="{% url 'yeast:labels' batch.id %}" method="post">
|
||||
<fieldset>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<!-- Main jumbotron for a primary marketing message or call to action -->
|
||||
<div class="jumbotron">
|
||||
<div class="container">
|
||||
<h1 class="display-3">Yeast Sample: {{ sample.id }}</h1>
|
||||
<h1 class="display-3">Yeast Sample: {{ yeast.id }}</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@ from yeast.views import YeastListView, BatchListView, home, sample, batch, batch
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
path('samples/<int:sample_id>/', sample, name='yeast'),
|
||||
path('samples/<int:yeast_id>/', sample, name='yeast'),
|
||||
path('samples/', YeastListView.as_view(), name='yeasts'),
|
||||
path('batches/addbatch/', addBatch.as_view(), name='addbatch'),
|
||||
path('batches/addstrain/', addStrain.as_view(), name='addstrain'),
|
||||
|
@ -18,9 +18,9 @@ class YeastListView(ListView):
|
||||
class BatchListView(ListView):
|
||||
model = Batch
|
||||
|
||||
def sample(request, sample_id):
|
||||
def sample(request, yeast_id):
|
||||
|
||||
sample = get_object_or_404(Yeast, pk=sample_id)
|
||||
sample = get_object_or_404(Yeast, pk=yeast_id)
|
||||
sample_batch = get_object_or_404(Batch, pk=sample.batch_id)
|
||||
return render(request, 'yeast/sample.html', {'sample': sample, 'batch':sample_batch})
|
||||
|
||||
@ -36,9 +36,7 @@ def batch_labels(request, batch_id):
|
||||
"""
|
||||
skip_count = request.POST.get("skip_count", "")
|
||||
samples = request.POST.getlist("samples", "")
|
||||
|
||||
batch = get_object_or_404(Batch, pk=batch_id)
|
||||
|
||||
to_print = list(filter(lambda d: str(d.id) in samples, batch.yeast_set.all()))
|
||||
|
||||
# Create the HttpResponse object with the appropriate PDF headers.
|
||||
@ -51,14 +49,6 @@ def batch_labels(request, batch_id):
|
||||
|
||||
labels = []
|
||||
for sample in to_print:
|
||||
# labels.append({
|
||||
# 'date': sample.batch.production_date,
|
||||
# 'name': sample.name,
|
||||
# 'manufacturer': sample.batch.strain.manufacturer.name,
|
||||
# 'id': sample.id,
|
||||
# 'blank': False,
|
||||
# 'host': request.get_host(),
|
||||
# })
|
||||
labels.append({
|
||||
'id': sample.id,
|
||||
'title': '{} {}'.format(sample.batch.strain.manufacturer.name, sample.batch.strain.name),
|
||||
|
Loading…
Reference in New Issue
Block a user