X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=htsworkflow%2Ffrontend%2Finventory%2Fviews.py;h=65040a1e10dbabd35dc565b78066c0dac36465d2;hb=b0b41b36b41c6a38b4306f9cc19bbfba7fc5f033;hp=7049320c9f79b5fd7adbc0ca4d6dbe3856dc97be;hpb=d6bab3013ba57b263ceeffdcb36f609533117de3;p=htsworkflow.git diff --git a/htsworkflow/frontend/inventory/views.py b/htsworkflow/frontend/inventory/views.py index 7049320..65040a1 100644 --- a/htsworkflow/frontend/inventory/views.py +++ b/htsworkflow/frontend/inventory/views.py @@ -90,15 +90,31 @@ def index(request): context_dict, context_instance=RequestContext(request)) + @login_required -def item_summary(request, uuid, msg=''): +def item_summary_by_barcode(request, barcode_id, msg=''): """ - Display a summary for an item + Display a summary for an item by barcode """ try: - item = Item.objects.get(uuid=uuid) + item = Item.objects.get(barcode_id=barcode_id) except ObjectDoesNotExist, e: item = None + + return item_summary_by_uuid(request, None, msg, item) + + +@login_required +def item_summary_by_uuid(request, uuid, msg='', item=None): + """ + Display a summary for an item + """ + # Use item instead of looking it up if it is passed. + if item is None: + try: + item = Item.objects.get(uuid=uuid) + except ObjectDoesNotExist, e: + item = None context_dict = { 'page_name': 'Item Summary', @@ -149,7 +165,7 @@ def item_print(request, uuid): if item is not None: msg = _item_print(item, request) - return item_summary(request, uuid, msg) + return item_summary_by_uuid(request, uuid, msg) def link_flowcell_and_device(request, flowcell, serial):