Hello, I have a filtered model
class Sku(object): manufacturer = ForeignKey(SomeModel) I want to filter the manufacturer's field, but considering only those manufacturers that the displayed Sku have, can you tell me where to look? It is a little code about which speech:
class SkuFilter(django_filters.FilterSet): # manufacturer__title = django_filters.CharFilter(lookup_expr='icontains') class Meta: model = Sku fields = ['manufacturer', ] # кусок из views # ... c['skus'] = self.object.skus.filter(hide=False, prices__price_type=PRICE_ROZN).prefetch_related('prices', 'stock').all().order_by( 'prices__value') sku_filter = SkuFilter(self.request.GET, c['skus']) # ... That is, in the end, there can be 4 products in c ['skus'], and manufacturers in the filter display everything, and only those that are in these four products are needed.