Needed to fix more reference to batch.
Everything seems to work now.
This commit is contained in:
parent
94810ebf8b
commit
51f37642eb
@ -6,7 +6,7 @@ from django.urls import reverse
|
||||
from django.http import JsonResponse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from yeast.models import Yeast, Propogation, Strain
|
||||
from yeast.models import Yeast, Propogation, Strain, Storage
|
||||
from config.extras import AveryLabel
|
||||
from yeast.forms import BatchAddForm, StrainAddForm
|
||||
|
||||
@ -24,21 +24,10 @@ def sample(request, yeast_id):
|
||||
sample = get_object_or_404(Yeast, pk=yeast_id)
|
||||
return render(request, 'yeast/sample.html', {
|
||||
'sample': sample,
|
||||
'batch': get_object_or_404(Propogation, pk=sample.batch_id),
|
||||
'batch': get_object_or_404(Propogation, pk=sample.propogation_id),
|
||||
'storage': list(Storage.objects.all()),
|
||||
})
|
||||
|
||||
# @login_required
|
||||
# def get_batches(request):
|
||||
# strains = {}
|
||||
# for strain in Strain.objects.all():
|
||||
# batches = [x.id for x in Batch.objects.filter(strain=strain)]
|
||||
# if batches:
|
||||
# strains[strain.id] = batches
|
||||
|
||||
# return JsonResponse(
|
||||
# {'data': [strains]})
|
||||
|
||||
def get_batch(request):
|
||||
batch_id = int(request.POST.get('batch'))
|
||||
re_url = reverse('yeast:batch', kwargs={'batch_id': batch_id})
|
||||
@ -86,8 +75,8 @@ def batch_labels(request, batch_id):
|
||||
for sample in to_print:
|
||||
labels.append({
|
||||
'id': sample.id,
|
||||
'title': '{} {}'.format(sample.batch.strain.manufacturer.name, sample.batch.strain.name),
|
||||
'data': ['ID: {}'.format(sample.id), 'Date: {}'.format(sample.batch.production_date)],
|
||||
'title': '{} {}'.format(sample.propogation.strain.manufacturer.name, sample.propogation.strain.name),
|
||||
'data': ['ID: {}'.format(sample.id), 'Date: {}'.format(sample.propogation.production_date)],
|
||||
'blank': False,
|
||||
'host': request.get_host(),
|
||||
'template': 'yeast',
|
||||
|
Loading…
Reference in New Issue
Block a user