def _update_part_info(user, asset, part_info_data): if not asset.part_info: part_info = PartInfo() else: part_info = asset.part_info part_info.device = part_info_data.get('device') part_info.source_device = part_info_data.get('source_device') part_info.barcode_salvaged = part_info_data.get('barcode_salvaged') part_info.save(user=user) asset.part_info = part_info asset.part_info.save(user=user) return asset
def create_part_info(self): part_info = PartInfo() part_info.source_device = self.asset part_info.device = self.asset part_info.save(user=self.request.user) return part_info