Fix incorrect name for yeast propogation lookup.
Also change references to `batch` to `propogation`.
This commit is contained in:
parent
17601109c6
commit
4a02f7db29
@ -12,10 +12,10 @@ urlpatterns = [
|
||||
path('samples/', YeastListView.as_view(), name='yeasts'),
|
||||
path('batches/addbatch/', login_required(addBatch.as_view()), name='addbatch'),
|
||||
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('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('', home, name='home'),
|
||||
]
|
||||
|
@ -37,7 +37,7 @@ def sample(request, yeast_id):
|
||||
propogate_form = PropogateSampleForm(request.POST)
|
||||
if propogate_form.is_valid():
|
||||
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:
|
||||
|
||||
return redirect('yeast:samples', kwargs={'yeast_id':yeast_id})
|
||||
@ -57,14 +57,14 @@ def sample(request, yeast_id):
|
||||
|
||||
|
||||
def get_batch(request):
|
||||
batch_id = int(request.POST.get('batch'))
|
||||
re_url = reverse('yeast:batch', kwargs={'batch_id': batch_id})
|
||||
propogation_id = int(request.POST.get('batch'))
|
||||
re_url = reverse('yeast:batch', kwargs={'propogation_id': propogation_id})
|
||||
return redirect(re_url)
|
||||
|
||||
def home(request):
|
||||
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.
|
||||
|
||||
@ -75,11 +75,11 @@ def batch(request, batch_id):
|
||||
: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})
|
||||
|
||||
|
||||
def batch_labels(request, batch_id):
|
||||
def batch_labels(request, propogation_id):
|
||||
"""
|
||||
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", "")
|
||||
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()))
|
||||
|
||||
# Create the HttpResponse object with the appropriate PDF headers.
|
||||
@ -122,7 +122,7 @@ class addBatch(CreateView):
|
||||
|
||||
def get_success_url(self):
|
||||
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):
|
||||
model = Strain
|
||||
|
Loading…
Reference in New Issue
Block a user