Compare commits
2 Commits
fbbe4acc1f
...
51f37642eb
Author | SHA1 | Date | |
---|---|---|---|
51f37642eb | |||
94810ebf8b |
1
run.sh
Normal file → Executable file
1
run.sh
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
source .env/bin/activate
|
||||
python manage.py runserver 0.0.0.0:9595
|
||||
|
@ -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')
|
||||
return reverse('yeast:batches')
|
||||
|
Loading…
Reference in New Issue
Block a user