PYTHON   98

Untitled

By masterpeace on 11th May 2022 04:12:06 AM

  1. Internal Server Error: /impa/imp/new
  2. Traceback (most recent call last):
  3.   File "C:\Python310\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
  4.     response = get_response(request)
  5.   File "C:\Python310\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
  6.     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  7.   File "C:\Python310\lib\site-packages\django\views\generic\base.py", line 84, in view
  8.     return self.dispatch(request, *args, **kwargs)
  9.   File "C:\Python310\lib\site-packages\django\contrib\auth\mixins.py", line 73, in dispatch
  10.     return super().dispatch(request, *args, **kwargs)
  11.   File "C:\Python310\lib\site-packages\django\views\generic\base.py", line 119, in dispatch
  12.     return handler(request, *args, **kwargs)
  13.   File "C:\Python310\lib\site-packages\django\views\generic\edit.py", line 184, in post
  14.     return super().post(request, *args, **kwargs)
  15.   File "C:\Python310\lib\site-packages\django\views\generic\edit.py", line 153, in post
  16.     return self.form_valid(form)
  17.   File "C:\Users\mesqu\Desktop\masterpeace\tloz\impa\views.py", line 34, in form_valid
  18.     for imp in range(numini,numfin):
  19. TypeError: 'tuple' object cannot be interpreted as an integer
  20. [10/May/2022 22:04:05] "POST /impa/imp/new HTTP/1.1" 500 89014
  21.  
  22.  
  23.  
  24. class impnew(LoginRequiredMixin, generic.CreateView):
  25.     model = ImpGuias
  26.     template_name = "impa/imp_new.html"
  27.     context_object_name = "obj"
  28.     form_class = ImpresionForm
  29.     success_url = reverse_lazy("impa:imp_list")
  30.     login_url = "bases:login"
  31.  
  32.     def form_valid(self, form, *numini, **numfin):
  33.         form.instance.uc = self.request.user
  34.         rango= []
  35.         impguias = ImpGuias
  36.         for imp in range(numini,numfin):
  37.             if numini>=numini.objects.filter(numini).exists() and numfin>=numfin.objects.filter(numfin).exists():
  38.                 mensaje = "Rango ya existe"
  39.             else:
  40.                 rango.append(impguias)
  41.         ImpGuias.objects.bulk_create(rango)
  42.         return super().form_valid(form)

Raw Paste


Login or Register to edit or fork this paste. It's free.