def add_library_kit_part_info(kitName, barcode): #print "Adding parts for library kit" try: kit = models.KitInfo.objects.get(kitType='LibraryKit', name=kitName) except: kit = None if kit: ##print "library kit found. Id:", kit.id, " kit name:", kit.name try: entry = models.KitPart.objects.get(barcode=barcode) except: entry = None if not entry: kwargs = { 'kit':kit, 'barcode':barcode } obj = models.KitPart(**kwargs) obj.save() ##else: ## print "Barcode:", barcode, " already exists" else: print "Kit:", kitName, " not found. Barcode:", barcode, " is not added"
def add_sequencing_kit_part_info(kitName, barcode): # print "Adding parts for sequencing kit" try: kit = models.KitInfo.objects.get(kitType="SequencingKit", name=kitName) except Exception: kit = None if kit: # print "sequencing kit found. Id:", kit.id, " kit name:", kit.name try: entry = models.KitPart.objects.get(barcode=barcode) except Exception: entry = None if not entry: kwargs = {"kit": kit, "barcode": barcode} obj = models.KitPart(**kwargs) obj.save() # else: # print "Barcode ", barcode, " already exists" else: print("Kit:", kitName, " not found. Barcode:", barcode, " is not added")