Fix incorrect name for yeast propogation lookup.

Also change references to `batch` to `propogation`.
This commit is contained in:
Chris Giacofei 2024-06-13 14:28:40 -04:00
parent 17601109c6
commit 4a02f7db29
2 changed files with 10 additions and 10 deletions

View File

@ -12,10 +12,10 @@ urlpatterns = [
path('samples/', YeastListView.as_view(), name='yeasts'), path('samples/', YeastListView.as_view(), name='yeasts'),
path('batches/addbatch/', login_required(addBatch.as_view()), name='addbatch'), path('batches/addbatch/', login_required(addBatch.as_view()), name='addbatch'),
path('batches/addstrain/', login_required(addStrain.as_view()), name='addstrain'), path('batches/addstrain/', login_required(addStrain.as_view()), name='addstrain'),
path('batches/<int:batch_id>/', batch, name='batch'), path('batches/<int:propogation_id>/', batch, name='batch'),
path('batches/', BatchListView.as_view(), name='batches'), path('batches/', BatchListView.as_view(), name='batches'),
path('batch_lookup/', get_batch, name='get_batch'), path('batch_lookup/', get_batch, name='get_batch'),
path('batch_labels/<int:batch_id>/', login_required(batch_labels), name='labels'), path('batch_labels/<int:propogation_id>/', login_required(batch_labels), name='labels'),
path('progation/add/', NewPropogation, name='propogate'), path('progation/add/', NewPropogation, name='propogate'),
path('', home, name='home'), path('', home, name='home'),
] ]

View File

@ -37,7 +37,7 @@ def sample(request, yeast_id):
propogate_form = PropogateSampleForm(request.POST) propogate_form = PropogateSampleForm(request.POST)
if propogate_form.is_valid(): if propogate_form.is_valid():
new_prop = propogate_form.create_propogation() new_prop = propogate_form.create_propogation()
return HttpResponseRedirect(reverse('yeast:batches', kwargs={'propogation_id': new_prop.id})) return HttpResponseRedirect(reverse('yeast:batch', kwargs={'propogation_id': new_prop.id}))
else: else:
return redirect('yeast:samples', kwargs={'yeast_id':yeast_id}) return redirect('yeast:samples', kwargs={'yeast_id':yeast_id})
@ -57,14 +57,14 @@ def sample(request, yeast_id):
def get_batch(request): def get_batch(request):
batch_id = int(request.POST.get('batch')) propogation_id = int(request.POST.get('batch'))
re_url = reverse('yeast:batch', kwargs={'batch_id': batch_id}) re_url = reverse('yeast:batch', kwargs={'propogation_id': propogation_id})
return redirect(re_url) return redirect(re_url)
def home(request): def home(request):
return render(request, 'yeast/home.html',{'batches': Propogation.objects.all, 'strains': Strain.objects.all}) return render(request, 'yeast/home.html',{'batches': Propogation.objects.all, 'strains': Strain.objects.all})
def batch(request, batch_id): def batch(request, propogation_id):
""" """
Display a batch of yeast samples. Display a batch of yeast samples.
@ -75,11 +75,11 @@ def batch(request, batch_id):
:template:`yeast/batch.html` :template:`yeast/batch.html`
""" """
batch = get_object_or_404(Propogation, pk=batch_id) batch = get_object_or_404(Propogation, pk=propogation_id)
return render(request, 'yeast/batch.html', {'batch': batch}) return render(request, 'yeast/batch.html', {'batch': batch})
def batch_labels(request, batch_id): def batch_labels(request, propogation_id):
""" """
Create label PDF for samples in a batch. Create label PDF for samples in a batch.
@ -90,7 +90,7 @@ def batch_labels(request, batch_id):
""" """
skip_count = request.POST.get("skip_count", "") skip_count = request.POST.get("skip_count", "")
samples = request.POST.getlist("samples", "") samples = request.POST.getlist("samples", "")
batch = get_object_or_404(Propogation, pk=batch_id) batch = get_object_or_404(Propogation, pk=propogation_id)
to_print = list(filter(lambda d: str(d.id) in samples, batch.yeast_set.all())) to_print = list(filter(lambda d: str(d.id) in samples, batch.yeast_set.all()))
# Create the HttpResponse object with the appropriate PDF headers. # Create the HttpResponse object with the appropriate PDF headers.
@ -122,7 +122,7 @@ class addBatch(CreateView):
def get_success_url(self): def get_success_url(self):
id = self.object.id #gets id from created object id = self.object.id #gets id from created object
return reverse('yeast:batches', kwargs={'batch_id': id}) return reverse('yeast:batch', kwargs={'propogation_id': id})
class addStrain(CreateView): class addStrain(CreateView):
model = Strain model = Strain