Skip to content

Commit 6b54703

Browse files
committed
Fixed the model for Django<1.6
1 parent 16508cf commit 6b54703

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ class ForeignKeyTarget(RESTFrameworkModel):
4949
name = models.CharField(max_length=100)
5050

5151
def get_first_source(self):
52-
return self.sources.first()
52+
try:
53+
return self.sources.all()[0]
54+
except IndexError:
55+
return None
5356

5457

5558
class ForeignKeySource(RESTFrameworkModel):

0 commit comments

Comments
 (0)