filter nested fields django code example
Example 1: django filter on related field
len(Collection.objects.filter(item__flag=True).distinct())
Example 2: filter field set in django formds
if request.method == "POST":
modelform = AgregarProducto(request.POST, request.FILES, user=request.user)
...
else:
modelform = AgregarProducto(user=request.user)