toastdriven/django-tastypie — pull request #1178 by jarrodb (2014-05-30 19:17:06+00:00)
Title: Prefer related_name on ToOneField to reverse fetch unique referencing object.

We treat memberships of resources as their own resource so it is sometimes beneficial for a ModelResource to reference a ToOneField (ForeignKey) that is joined by another resource. This is similar to the ToManyField functionality, except returns only a single object per the constraints on the ForeignKey uniqueness defined by the membership Model.

```
class NumberResource(ModelResource):
detail = fields.ToOneField(
'number.api.NumberDetailResource',
'detail',
related_name='numberdetail_set',
null=True
)

class Meta:
queryset = Number.objects.all()

class NumberDetailResource(ModelResource):
number = fields.ToOneField(NumberResource, 'number')

class Meta:
queryset = NumberDetail.objects.all()
```