From 0d0f5e2373549115497056e454071a1ea2310788 Mon Sep 17 00:00:00 2001 From: Chris GIACOFEI Date: Wed, 5 Jun 2024 14:14:39 -0400 Subject: [PATCH] Documentation things. --- config/settings.py | 1 + yeast/views.py | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/config/settings.py b/config/settings.py index 13f1ebf..d9a06a4 100644 --- a/config/settings.py +++ b/config/settings.py @@ -51,6 +51,7 @@ MIDDLEWARE = [ 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'django.contrib.admindocs.middleware.XViewMiddleware', # 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', # "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware", # 'django.contrib.messages.middleware.MessageMiddleware', diff --git a/yeast/views.py b/yeast/views.py index 986b653..b4cf666 100644 --- a/yeast/views.py +++ b/yeast/views.py @@ -28,11 +28,26 @@ def home(request): return render(request, 'yeast/home.html',{}) def batch(request, batch_id): + """ + Display a batch of yeast samples. + + ``Batch`` + An instance of :model:`yeast.Batch`. + + ``Template`` + :template:`yeast/batch.html` + """ batch = get_object_or_404(Batch, pk=batch_id) return render(request, 'yeast/batch.html', {'batch': batch}) def batch_labels(request, batch_id): - """ Create label PDF for samples in a batch + """ + Create label PDF for samples in a batch. + + **Context** + + ``Batch`` + An instance of :model:`yeast.Batch`. """ skip_count = request.POST.get("skip_count", "") samples = request.POST.getlist("samples", "") @@ -46,7 +61,7 @@ def batch_labels(request, batch_id): logger.critical(samples) logger.critical(to_print) - + labels = [] for sample in to_print: labels.append({ @@ -59,7 +74,7 @@ def batch_labels(request, batch_id): 'ns': 'yeast' }) labelSheet.render(labels, response, skip_count) - + return response class addBatch(CreateView):