Good, I have a problem because I want to filter the data of an FK in a serializer.
class ProductoArmarioSerializer(serializers.ModelSerializer):
imagenes = FotoSerializer(many=True)
tallas = StockSerializer(many=True)
class Meta:
model = Producto
fields = ['id', 'nombre', 'color', 'estado_prod', 'descrip', 'medidas', 'p_compra', 'categoria',
'p_venta', 'estado_rev', 'marca', 'imagenes','escaparate','tallas']
class MiArmarioSerializer(serializers.ModelSerializer):
productos = ProductoArmarioSerializer(many=True)
usuario = UserSerializer()
seguidores = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
likes = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
class Meta:
model = Perfil
fields = ['id','usuario','boutique','tel','entrg_pais','entrg_dep',
'entrg_ciudad','entrg_direccion','entrg_cp','rmt_pais','rmt_dep',
'rmt_direccion','rmt_ciudad','rmt_cp','num_cc','avatar','descp_armario',
'tipo_ident','cedula','nit','tarjeta','alt_tarjeta','propietario_cc',
'banco','tipo_cc','follow','seguidores','productos','likes']
I want the products that you return to be those that have status_rev = 4 and the rest discard them