You can check this once, https://stackoverflow.com/questions/38934042/django-typeerror-missing-1-required-positional-argument-person-id
On Wed, Jun 17, 2020 at 9:40 AM Adya Mit <adyamit...@gmail.com> wrote: > did not work > > views.py > > class EmployeeCBV(View): > def get(self,request,id,*args,**kwargs): > emp=Employee.objects.get(id=id) > json_data=serialize('json',[emp,]) > > return HttpResponse(json_data,content_type='application/json') > > > urls.py > > from django.contrib import admin > from django.urls import path > from testapp import views > > urlpatterns = [ > path('admin/', admin.site.urls), > path('home/',views.EmployeeCBV.as_view(),name='home'), > > ] > > result: > > TypeError > at /home/ > > get() missing 1 required positional argument: 'id' > > Request Method: GET > Request URL: http://127.0.0.1:8000/home/ > Django Version: 3.0.6 > Exception Type: TypeError > Exception Value: > > get() missing 1 required positional argument: 'id' > > Exception Location: > C:\Users\adyam\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\generic\base.py > in dispatch, line 97 > Python Executable: > C:\Users\adyam\AppData\Local\Programs\Python\Python37\python.exe > Python Version: 3.7.5 > Python Path: > > ['C:\\Users\\adyam\\PycharmProjects\\RestApi1\\withoutrestm', > 'C:\\Users\\adyam\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip', > 'C:\\Users\\adyam\\AppData\\Local\\Programs\\Python\\Python37\\DLLs', > 'C:\\Users\\adyam\\AppData\\Local\\Programs\\Python\\Python37\\lib', > 'C:\\Users\\adyam\\AppData\\Local\\Programs\\Python\\Python37', > 'C:\\Users\\adyam\\AppData\\Roaming\\Python\\Python37\\site-packages', > > 'C:\\Users\\adyam\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages'] > > Server time: Wed, 17 Jun 2020 04:05:09 +0000 > > -- > 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/00451532-6e7f-433a-a21b-d8c5e2afecf6o%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/00451532-6e7f-433a-a21b-d8c5e2afecf6o%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/CANaPPPKxshoCFgEnRrh0VKt4v4hpMaP4FdedoWavn4VggKBXuQ%40mail.gmail.com.