From b4ad7e531eed51310ef1d3ae14aaee42373f9a71 Mon Sep 17 00:00:00 2001 From: Brandon King Date: Wed, 21 May 2008 17:22:54 +0000 Subject: [PATCH] Added custom view to display libraries, when a library is selected it says what flowcells and lanes the library was placed on. * url: /library/ (index) * url: /library// (flowcell/lane output) --- gaworkflow/frontend/fctracker/views.py | 34 ++++++++++++++++++++++++++ gaworkflow/frontend/urls.py | 2 ++ 2 files changed, 36 insertions(+) diff --git a/gaworkflow/frontend/fctracker/views.py b/gaworkflow/frontend/fctracker/views.py index 60f00ef..11b5e49 100644 --- a/gaworkflow/frontend/fctracker/views.py +++ b/gaworkflow/frontend/fctracker/views.py @@ -1 +1,35 @@ # Create your views here. +from gaworkflow.frontend.fctracker.models import Library +from django.http import HttpResponse + +#from django.db.models import base + +def library(request): + library_list = Library.objects.all() #.order_by('-pub_date') + rep_string = '%s - %s (%s)' + output = '
\n'.join([rep_string \ + % (l.library_id, + l.library_id, + l.library_name, + l.library_species.scientific_name) for l in library_list]) + return HttpResponse(output) + +def library_to_flowcells(request, lib_id): + + try: + lib = Library.objects.get(library_id=lib_id) + except: + return HttpResponse("Library %s does not exist" % (lib_id)) + + output = [] + + output.extend([ '%s - Lane 1' % (fc.flowcell_id) for fc in lib.lane_1_library.all() ]) + output.extend([ '%s - Lane 2' % (fc.flowcell_id) for fc in lib.lane_2_library.all() ]) + output.extend([ '%s - Lane 3' % (fc.flowcell_id) for fc in lib.lane_3_library.all() ]) + output.extend([ '%s - Lane 4' % (fc.flowcell_id) for fc in lib.lane_4_library.all() ]) + output.extend([ '%s - Lane 5' % (fc.flowcell_id) for fc in lib.lane_5_library.all() ]) + output.extend([ '%s - Lane 6' % (fc.flowcell_id) for fc in lib.lane_6_library.all() ]) + output.extend([ '%s - Lane 7' % (fc.flowcell_id) for fc in lib.lane_7_library.all() ]) + output.extend([ '%s - Lane 8' % (fc.flowcell_id) for fc in lib.lane_8_library.all() ]) + + return HttpResponse('
\n'.join(output)) diff --git a/gaworkflow/frontend/urls.py b/gaworkflow/frontend/urls.py index 0c67015..af875b2 100644 --- a/gaworkflow/frontend/urls.py +++ b/gaworkflow/frontend/urls.py @@ -13,4 +13,6 @@ urlpatterns = patterns('', (r'^admin/', include('django.contrib.admin.urls')), # Databrowser: (r'^databrowse/(.*)', databrowse.site.root), + (r'^library/$', 'gaworkflow.frontend.fctracker.views.library'), + (r'^library/(?P\w+)/$', 'gaworkflow.frontend.fctracker.views.library_to_flowcells') ) -- 2.30.2