1👍
✅
since you are using generic DetailView
you can refer to the current object with self.get_object()
. actually that return the single object that view display. however you can use instateself.object
too.
so you can filter the Product
related Resource
s using Resource.objects.filter(resources=self.get_object(), type='sales')
you can read more Single object mixins
Source:stackexchange.com