It means that the data which you are looking for is not exists in that data base, check properly wether the searching data is exists or not,
Thank you Sachin b.g On Sun, 13 Jun, 2021, 6:53 AM Nikeet NA, <nik...@exiverlabs.co.in> wrote: > There is no user with id 1. > Wrap this statement inside try catch block : > user = User.objects.get(id=uid) > and catch the DoesNotExist exception as except User.DoesNotExist: > > On Saturday, 12 June 2021 at 18:13:09 UTC+5:30 shilpa...@gmail.com wrote: > >> Environment: >> >> >> Request Method: GET >> Request URL: http://127.0.0.1:8000/addToCart/1 >> >> Django Version: 3.2.3 >> Python Version: 3.9.1 >> Installed Applications: >> ['django.contrib.admin', >> 'django.contrib.auth', >> 'django.contrib.contenttypes', >> 'django.contrib.sessions', >> 'django.contrib.messages', >> 'django.contrib.staticfiles', >> 'MusicalApp.apps.MusicalappConfig', >> 'CartApp.apps.CartappConfig'] >> Installed Middleware: >> ['django.middleware.security.SecurityMiddleware', >> 'django.contrib.sessions.middleware.SessionMiddleware', >> 'django.middleware.common.CommonMiddleware', >> 'django.middleware.csrf.CsrfViewMiddleware', >> 'django.contrib.auth.middleware.AuthenticationMiddleware', >> 'django.contrib.messages.middleware.MessageMiddleware', >> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] >> >> >> >> Traceback (most recent call last): >> File >> "D:\DjangoDemos\venv\lib\site-packages\django\core\handlers\exception.py", >> line 47, in inner >> response = get_response(request) >> File >> "D:\DjangoDemos\venv\lib\site-packages\django\core\handlers\base.py", line >> 181, in _get_response >> response = wrapped_callback(request, *callback_args, >> **callback_kwargs) >> File "D:\DjangoDemos\CartApp\views.py", line 15, in addToCart >> user = User.objects.get(id=uid) >> File >> "D:\DjangoDemos\venv\lib\site-packages\django\db\models\manager.py", line >> 85, in manager_method >> return getattr(self.get_queryset(), name)(*args, **kwargs) >> File "D:\DjangoDemos\venv\lib\site-packages\django\db\models\query.py", >> line 435, in get >> raise self.model.DoesNotExist( >> >> Exception Type: DoesNotExist at /addToCart/1 >> Exception Value: User matching query does not exist. >> > -- > 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 django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/1b7cff79-a0eb-4559-ab17-1d9d0f701343n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/1b7cff79-a0eb-4559-ab17-1d9d0f701343n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOs61rz3X4KBT9MJdFOoion0N4UvH0V_YM%3DhQA3DY%2BZzce8o3w%40mail.gmail.com.