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

Don't serialize fields from ForeignKey definition #76

Closed
Stefan72Git opened this issue Mar 1, 2016 · 1 comment · Fixed by #78
Closed

Don't serialize fields from ForeignKey definition #76

Stefan72Git opened this issue Mar 1, 2016 · 1 comment · Fixed by #78
Labels

Comments

@Stefan72Git
Copy link

When i try to serialize fields from ForeignKey definition I receive the following warnings:

serializers.py:312: RemovedInDjango110Warning: 'get_all_related_objects is an unofficial API that has been deprecated. You may be able to replace it with 'get_fields()'
reversed_fields = [obj.field for obj in opts.get_all_related_objects()]

serializers.py:313: RemovedInDjango110Warning: 'get_all_related_many_to_many_objects is an unofficial API that has been deprecated. You may be able to replace it with 'get_fields()'
reversed_fields += [obj.field for obj in opts.get_all_related_many_to_many_objects()]

@XavierCLL
Copy link

With Django 1.10 this is a error:

Internal Server Error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/utils/decorators.py", line 67, in _wrapper
    return bound_func(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/utils/decorators.py", line 63, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/usr/local/lib/python3.5/site-packages/djgeojson/views.py", line 79, in dispatch
    return super(GeoJSONLayerView, self).dispatch(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/django/views/generic/list.py", line 175, in get
    return self.render_to_response(context)
  File "/usr/local/lib/python3.5/site-packages/djgeojson/views.py", line 69, in render_to_response
    **options)
  File "/usr/local/lib/python3.5/site-packages/djgeojson/serializers.py", line 379, in serialize
    self.serialize_queryset(queryset)
  File "/usr/local/lib/python3.5/site-packages/djgeojson/serializers.py", line 312, in serialize_queryset
    reversed_fields = [obj.field for obj in opts.get_all_related_objects()]
AttributeError: 'Options' object has no attribute 'get_all_related_objects'

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

Successfully merging a pull request may close this issue.

3 participants