Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Options" fails on a many-relational field #3061

Closed
hiaselhans opened this issue Jun 23, 2015 · 1 comment
Closed

"Options" fails on a many-relational field #3061

hiaselhans opened this issue Jun 23, 2015 · 1 comment

Comments

@hiaselhans
Copy link

i have a field as follows:

sessions = serializers.HyperlinkedRelatedField(many=True,
                                                   read_only=True,
                                                   view_name="session-detail",
                                                   allow_null=True)

similar to http://www.django-rest-framework.org/api-guide/relations/#hyperlinkedrelatedfield
when running an OPTIONS request i get the following TypeError:

Traceback:
File "/usr/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.4/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)
File "/usr/lib/python3.4/site-packages/rest_framework/viewsets.py" in view
  85.             return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/rest_framework/views.py" in dispatch
  451.             response = self.handle_exception(exc)
File "/usr/lib/python3.4/site-packages/rest_framework/views.py" in dispatch
  448.             response = handler(request, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/rest_framework/views.py" in options
  462.         data = self.metadata_class().determine_metadata(request, self)
File "/usr/lib/python3.4/site-packages/rest_framework/metadata.py" in determine_metadata
  64.             actions = self.determine_actions(request, view)
File "/usr/lib/python3.4/site-packages/rest_framework/metadata.py" in determine_actions
  90.                 actions[method] = self.get_serializer_info(serializer)
File "/usr/lib/python3.4/site-packages/rest_framework/metadata.py" in get_serializer_info
  107.             for field_name, field in serializer.fields.items()
File "/usr/lib/python3.4/site-packages/rest_framework/metadata.py" in <listcomp>
  107.             for field_name, field in serializer.fields.items()
File "/usr/lib/python3.4/site-packages/rest_framework/metadata.py" in get_field_info
  130.         if hasattr(field, 'choices'):
File "/usr/lib/python3.4/site-packages/rest_framework/relations.py" in choices
  382.             for item in iterable

Exception Type: TypeError at /api/gliders/
Exception Value: 'NoneType' object is not iterable
@xordoquy
Copy link
Collaborator

Looks like #2674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants