fix: revert PR-1380

This commit is contained in:
Laurent Riviere 2023-07-26 10:00:23 +00:00
parent 34cef2bccd
commit 047810fe9a
3 changed files with 16 additions and 17 deletions

View File

@ -1073,6 +1073,9 @@ def test_proxy_model_support():
assert result.data == expected
@pytest.mark.xfail(
reason="Until https://github.com/graphql-python/graphene-django/pull/1380#issuecomment-1646331317 is fixed."
)
def test_model_inheritance_support_reverse_relationships():
"""
This test asserts that we can query reverse relationships for all Reporters and proxied Reporters and multi table Reporters.

View File

@ -19,6 +19,9 @@ def test_get_model_fields_no_duplication():
assert len(film_fields) == len(film_name_set)
@pytest.mark.xfail(
reason="Until https://github.com/graphql-python/graphene-django/pull/1380#issuecomment-1646331317 is fixed."
)
def test_get_reverse_fields_includes_proxied_models():
reporter_fields = get_reverse_fields(Reporter, [])
cnn_reporter_fields = get_reverse_fields(CNNReporter, [])

View File

@ -47,14 +47,7 @@ def _get_model_ancestry(model):
def get_reverse_fields(model, local_field_names):
"""
Searches through the model's ancestry and gets reverse relationships the models
Yields a tuple of (field.name, field)
"""
model_ancestry = _get_model_ancestry(model)
for _model in model_ancestry:
for name, attr in _model.__dict__.items():
for name, attr in model.__dict__.items():
# Don't duplicate any local fields
if name in local_field_names:
continue