Hi,

What does your router look like ?

Regards,
Xavier O.
Le 25 sept. 2020 à 13:48 +0200, Pradyum Gupta <pradyum.gup...@gmail.com>, a 
écrit :
> See I don't know this is actually a very weird error that am receiving.
>
> Inside *Company App*
>
> views.py
> ```python3
> class CompanyView(generics.ListCreateAPIView):
>     queryset = CompanyProfile.objects.all()
>     serializer_class = RegisterationCompanySerializer
>     permission_classes = (permissions.IsAuthenticated,)
>
>     def post(self, request, *args, **kwargs):
>         import pdb; pdb.set_trace() #check weather post request is getting 
> called?
>         return self.create(request, *args, **kwargs)
>
>     def get_serializer(self, *args, **kwargs):
>         import pdb; pdb.set_trace() #check weather post serializer is getting 
> called?
>         user_id = self.request.user.id
>         serializer_class = self.get_serializer_class()
>         .....
>         kwargs['data'] = draft_request_data
>         return serializer_class(*args, **kwargs)
>
> ```
>
> urls.py inside the company app
> ```
> urlpatterns = [
>     path('', include(router.urls)),
>
>     ## Register Company Process
>     # path('List/', ListCompanyView.as_view()),
>     path('Reg/', CompanyView.as_view()),
> ]
>
> ```
> serializer.py
> ```python
> class RegisterationCompanySerializer(serializers.ModelSerializer):
>
>     class Meta:
>         model = CompanyProfile
>         fields = '__all__'
>         extra_kwargs = {
>                         'short_name': {'required': True},
>                         ......
>                         'user' : {'required': True},
>                        }
>
> ```
>
> models.py
> ```python
> class CompanyProfile(models.Model):
>     id                  = models.UUIDField(default=uuid.uuid4,
>                                             editable=False,
>                                             primary_key=True,
>                                             verbose_name='ID',)
>    ......
>    verified             = models.BooleanField(default=False)
>
>     def __str__(self):
>         return str(self.id)
> ```
>
> Also, note the ```company``` is present in ```INSTALLED_APPS```
>
> But error am receiving this is on postman
> ```
> {
>     "detail": "Method \"POST\" not allowed."
> }
> ```
>
> on the terminal and tried PDB to check whether the function is getting called
> ```
> Method Not Allowed: /company/Reg/
> [Date and Time] "POST /company/Reg/ HTTP/1.1" 405 41
> ```
>
> let me know if you are looking for more details.
>
> Thanks in advance
>
> Regards
> Please also find the same question here 
> https://stackoverflow.com/q/64063496/7999665
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-rest-framework+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-rest-framework/PU1PR04MB23892F217077E14B042A0CB1A7360%40PU1PR04MB2389.apcprd04.prod.outlook.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/b3ef8c97-d65e-4a02-810e-018edcceea2d%40Spark.

Reply via email to