Skip to content

Commit

Permalink
Fixed the model for Django<1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
delinhabit committed Jul 25, 2015
1 parent 16508cf commit 6b54703
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/models.py
Expand Up @@ -49,7 +49,10 @@ class ForeignKeyTarget(RESTFrameworkModel):
name = models.CharField(max_length=100)

def get_first_source(self):
return self.sources.first()
try:
return self.sources.all()[0]
except IndexError:
return None


class ForeignKeySource(RESTFrameworkModel):
Expand Down

0 comments on commit 6b54703

Please sign in to comment.