Closed
Description
Hi!
When running our test suite with Python warnings enabled (eg PYTHONWARNINGS=once pytest
), we get the following deprecation warnings:
.../site-packages/graphene_django/utils.py:61: RemovedInDjango20Warning: Usage of field.rel has been deprecated. Use field.remote_field instead.
if hasattr(field, 'rel'):
.../site-packages/graphene_django/utils.py:63: RemovedInDjango20Warning: Usage of ForeignObjectRel.to attribute has been deprecated. Use the model attribute instead.
return field.rel.to
These line numbers correspond to:
https://github.com/graphql-python/graphene-django/blob/v1.3/graphene_django/utils.py#L61
https://github.com/graphql-python/graphene-django/blob/v1.3/graphene_django/utils.py#L63
The deprecation docs for this are here:
https://docs.djangoproject.com/en/1.11/releases/1.9/#field-rel-changes
I'm presuming the solution would be to either:
- Drop support for Django 1.6/1.7 entirely
- Invert the conditional, such that it does
hasattr(field, 'related_model')
and if not found then falls back tofield.rel.to
.
Given Django <1.8 is EOL and has security vulnerabilities, I'd lean towards solution (1).
This was using:
- graphene-django 1.3
- graphene 1.4.1
- Django 1.11.4
- Python 2.7.13
Metadata
Metadata
Assignees
Labels
No labels