Skip to content

Commit b1d6fc2

Browse files
authored
Merge pull request #145 from AltSchool/fix/django110
fix bug where model field lacks args
2 parents 61c944a + 8a9a8ab commit b1d6fc2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

dynamic_rest/fields/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def bind(self, *args, **kwargs):
120120
remote = is_field_remote(parent_model, self.source)
121121

122122
try:
123-
model_field = get_model_field()
123+
model_field = get_model_field(parent_model, self.source)
124124
except:
125125
# model field may not be available for m2o fields with no
126126
# related_name

tests/test_api.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ def test_options(self):
884884
'default': None,
885885
'immutable': False,
886886
'label': 'Users',
887-
'nullable': False,
887+
'nullable': True,
888888
'read_only': False,
889889
'related_to': 'users',
890890
'required': False,
@@ -894,7 +894,7 @@ def test_options(self):
894894
'default': None,
895895
'immutable': False,
896896
'label': 'Cats',
897-
'nullable': False,
897+
'nullable': True,
898898
'read_only': False,
899899
'related_to': 'cats',
900900
'required': False,
@@ -904,7 +904,7 @@ def test_options(self):
904904
'default': None,
905905
'immutable': False,
906906
'label': 'Bad cats',
907-
'nullable': False,
907+
'nullable': True,
908908
'read_only': False,
909909
'related_to': 'cats',
910910
'required': False,
@@ -928,8 +928,9 @@ def test_options(self):
928928
# Django 1.7 and 1.9 differ in their interpretation of
929929
# "nullable" when it comes to inverse relationship fields.
930930
# Ignore the values for the purposes of this comparison.
931-
del actual['properties']['friendly_cats']['nullable']
932-
del expected['properties']['friendly_cats']['nullable']
931+
for field in ['cats', 'friendly_cats', 'bad_cats', 'users']:
932+
del actual['properties'][field]['nullable']
933+
del expected['properties'][field]['nullable']
933934
self.assertEquals(
934935
json.loads(json.dumps(expected)),
935936
json.loads(json.dumps(actual))

0 commit comments

Comments
 (0)