it's quite expected behavior. if you want to check if job exists, you 
better use Job.objects.filter(name=job_name).exists()

On Monday, October 21, 2019 at 3:49:01 PM UTC+3, Gourab Mahapatra wrote:
>
> Traceback:
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\core\handlers\exception.py"
>  
> in inner
>   34.             response = get_response(request)
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\core\handlers\base.py"
>  
> in _get_response
>   115.                 response = self.process_exception_by_middleware(e, 
> request)
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\core\handlers\base.py"
>  
> in _get_response
>   113.                 response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\contrib\auth\decorators.py"
>  
> in _wrapped_view
>   21.                 return view_func(request, *args, **kwargs)
>
> File "C:\Users\Admin\PycharmProjects\autotask\autotask\dashboard\views.py" 
> in add_job
>   41. if form.is_valid():
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\forms\forms.py"
>  
> in is_valid
>   185.         return self.is_bound and not self.errors
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\forms\forms.py"
>  
> in errors
>   180.             self.full_clean()
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\forms\forms.py"
>  
> in full_clean
>   381.         self._clean_fields()
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\forms\forms.py"
>  
> in _clean_fields
>   402.                     value = getattr(self, 'clean_%s' % name)()
>
> File "C:\Users\Admin\PycharmProjects\autotask\autotask\dashboard\forms.py" 
> in clean_job
>   46. job_db = Job.objects.get(job_name=job)
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\db\models\manager.py"
>  
> in manager_method
>   82.                 return getattr(self.get_queryset(), name)(*args, 
> **kwargs)
>
> File 
> "C:\Users\Admin\PycharmProjects\autotask\AutoTaskVenv\lib\site-packages\django\db\models\query.py"
>  
> in get
>   408.                 self.model._meta.object_name
>
> Exception Type: DoesNotExist at /dashboard/add_job/
> Exception Value: Job matching query does not exist.
>
> but when i use the query on cmd prompt then it works fine.
> How to fix this? plz help
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/42bfb6a9-963e-4cb8-a2d9-8e2cf540bffa%40googlegroups.com.

Reply via email to