diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 diff --git a/yeast/templates/yeast/batch_list.html b/yeast/templates/yeast/propogation_list.html similarity index 100% rename from yeast/templates/yeast/batch_list.html rename to yeast/templates/yeast/propogation_list.html diff --git a/yeast/views.py b/yeast/views.py index fa9e5a2..ea1d6e0 100644 --- a/yeast/views.py +++ b/yeast/views.py @@ -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', @@ -111,4 +100,4 @@ class addStrain(CreateView): def get_success_url(self): id = self.object.id #gets id from created object - return reverse('yeast:batches') \ No newline at end of file + return reverse('yeast:batches')