[Answer]-Compare fields of same model

1👍

I am wondering if match should actually be match__exact? Have you tried the following to see if it makes any difference? I also prefer to use the Q class. https://docs.djangoproject.com/en/1.7/ref/models/queries/

from django.db.models import Q

    home_trend =  ResultForecast.objects.filter(
        Q(match__exact=match) & 
        Q(home_goals__gt=F('away_goals')))

    away_trend = ResultForecast.objects.filter(
        Q(match__exact=match) & 
        Q(away_goals__gt=F('home_goals')))

Leave a comment