コード例 #1
0
ファイル: List.py プロジェクト: jonathancg90/appSpiral
    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
コード例 #2
0
 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
コード例 #3
0
ファイル: List.py プロジェクト: jonathancg90/appSpiral
 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
コード例 #4
0
    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