If you set `http_method_names = ['get']` and the POST is on the same
endpoint it won't allow a POST. You might want to add 'post' to that
variable.
I, myself don't use ViewSets. I tend to use generic Views. In your case
the ListCreateAPIView generic view in this case. You can find it at
https://www.django-rest-framework.org/api-guide/generic-views/#listcreateapiview

~Carl

On Tue, Sep 29, 2020 at 11:16 AM Ali Yazdi <ma.yazd...@gmail.com> wrote:

> 1. I have a `viewsets.ModelViewSet` that has `http_method_names = ['get']`
> 2. and its action method needs to have `methods=['get', 'post']`
> 3. But `post` method is not allowed for its action
> 4. I don't is it normal behavior to have this scenario or not?
>
> --
> 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/abec1376-0619-4557-a7ea-1bab1f6473aan%40googlegroups.com
> <https://groups.google.com/d/msgid/django-rest-framework/abec1376-0619-4557-a7ea-1bab1f6473aan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
-------------------------------------------------------------------------------
Carl J. Nobile (Software Engineer)
carl.nob...@gmail.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/CAGQqDQJVB8UxbHEnnYAM4M%2BSkXxGQLBzPsy_NPHr9TNri5yAYg%40mail.gmail.com.

Reply via email to