Added support for Django 1.8.x

Since I didn't know why the `rel` attribute wasn't there in the first place, maybe it's better to use the `remote_field` only if it's there and leave `rel` as a default (i.e else).
This commit is contained in:
eyal0803 2018-02-23 12:20:37 +02:00 committed by GitHub
parent e51f6070df
commit e12c329507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ class GrapheneFilterSetMixin(BaseFilterSet):
Global IDs (the default implementation expects database
primary keys)
"""
rel = f.field.remote_field
rel = f.field.remote_field if hasattr(f.field, 'remote_field') else f.field.rel
default = {
'name': name,
'label': capfirst(rel.related_name)