def save_list(self, data): try: if DetailList.objects.filter(list_id=data.get("list_id"), model_id=data.get("model_id")).exists(): return None, self.WARNING_ADD detail_list = DetailList() detail_list.model = Model.objects.get(pk=data.get("model_id")) detail_list.list = List.objects.get(pk=data.get("list_id")) detail_list.save() return detail_list, self.SAVE_SUCCESSFUL except Exception, e: return None, self.SAVE_ERROR
def save_detail_list(self, data): try: detail_list = DetailList() detail_list.list = List.objects.get(pk=self.kwargs.get('pk')) detail_list.name_complete = data.get('model').get('name_complete') detail_list.DNI = data.get('model').get('dni') detail_list.phone = data.get('model').get('phone') detail_list.observation = data.get('observation') detail_list.save() return detail_list, self.SAVE_SUCCESSFUL except Exception, e: return None, self.SAVE_ERROR
def save_detail_list(self, data): try: detail_list = DetailList() detail_list.list = List.objects.get(pk=self.kwargs.get("pk")) detail_list.name_complete = data.get("model").get("name_complete") detail_list.DNI = data.get("model").get("dni") detail_list.phone = data.get("model").get("phone") detail_list.observation = data.get("observation") detail_list.save() return detail_list, self.SAVE_SUCCESSFUL except Exception, e: return None, self.SAVE_ERROR
def save_list(self, data): try: if DetailList.objects.filter( list_id=data.get('list_id'), model_id=data.get('model_id')).exists(): return None, self.WARNING_ADD detail_list = DetailList() detail_list.model = Model.objects.get(pk=data.get('model_id')) detail_list.list = List.objects.get(pk=data.get('list_id')) detail_list.save() return detail_list, self.SAVE_SUCCESSFUL except Exception, e: return None, self.SAVE_ERROR