Ejemplo n.º 1
0
 def post(self, request, *args, **kwargs):
     try:
         password = json.loads(str(self.request.body,
                                   'utf-8')).get('password', "")
         user = checkPassword(self.request.user.email, password)
         if not user:
             data = dict(status=False, msg="Contraseña Incorrecta")
             return JsonResponse(data)
         return self.delete(request, *args, **kwargs)
     except Exception as e:
         data = dict(status=False, data=e)
     return JsonResponse(data)
Ejemplo n.º 2
0
 def form_valid(self, form):
     password = self.request.POST.get('password', '')
     user = checkPassword(self.request.user.email, password)
     if not user:
         return render(
             self.request, self.template_name, {
                 'form': form,
                 'company': self.getCompany(),
                 'message': "Contraseña Incorrecta",
                 'edit': True
             })
     return super(AccountCompanyUpdateView, self).form_valid(form)
Ejemplo n.º 3
0
    def post(self, request, *args, **kwargs):
        data = self.get_data()
        _id = data.get('id', '')
        value = data.get('value', '')
        if value == '' or _id == '':
            data = dict(status=False, msg="No Puede Estar Vacio")
            return JsonResponse(data)
        user = checkPassword(self.request.user.email, value)
        if not user:
            data = dict(status=False, msg="Contraseña Incorrecta")
            return JsonResponse(data)

        try:
            get_object_or_404(self.model, pk=_id).delete()
            data = dict(status=True, msg="Tipo De Compañia Eliminada")
        except Exception:
            data = dict(status=False,
                        msg="No Se Puede Eliminar El Tipo De Compañia")
        return JsonResponse(data)