Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## models.py
- class UserProfile(models.Model):
- username = models.CharField(max_length=100, blank=True, null=True)
- email = models.EmailField()
- friends = models.ManyToManyField('self')
- ## resources.py
- class UserProfileResource(ModelResource):
- friends = fields.ToManyField('self', 'friends')
- class Meta:
- queryset = UserProfile.objects.all()
- filtering = {
- 'friends': ['exact'],
- }
- ## Queries:
- - friends=1 ## Works
- - friends__friends=1 ## Fails unless I use ALL_WITH_RELATIONS in filtering
- ## Tastypie lines concerned:
- ## https://github.com/toastdriven/django-tastypie/blob/master/tastypie/resources.py#L1625-1626
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement