Django-rest-framework: exception got an unexpected keyword argument 'many'

Created on 23 Nov 2019  路  4Comments  路  Source: encode/django-rest-framework

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
    response = handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/mixins.py", line 45, in list
    serializer = self.get_serializer(queryset, many=True)
  File "/usr/local/lib/python3.7/site-packages/rest_framework/generics.py", line 110, in get_serializer
    return serializer_class(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/models/base.py", line 501, in __init__
    raise TypeError("%s() got an unexpected keyword argument '%s'" % (cls.__name__, kwarg))
TypeError: Ingrediente() got an unexpected keyword argument 'many'

Most helpful comment

Hi @Allan-Nava. As has been pointed out to you several times, the GitHub issue tracker is intended for bug reports and feature requests. If you need help or support, there are a few places to ask questions, such as IRC, Stack Overflow, and the Google Group.

Also, please read the error in your stack trace.

TypeError: Ingrediente() got an unexpected keyword argument 'many'

It looks like you've passed your serializer_class to your model class, which is incorrect.

All 4 comments

Hi @Allan-Nava. As has been pointed out to you several times, the GitHub issue tracker is intended for bug reports and feature requests. If you need help or support, there are a few places to ask questions, such as IRC, Stack Overflow, and the Google Group.

Also, please read the error in your stack trace.

TypeError: Ingrediente() got an unexpected keyword argument 'many'

It looks like you've passed your serializer_class to your model class, which is incorrect.

I solved thanks

How? @Allan-Nava

Just a cut and paste error on my part, so change serializer_class = MyModelName to serializer_class = MyModelNameSerializer in your viewset.

Was this page helpful?
0 / 5 - 0 ratings