[Solved] How to filter Django queryset by non field values


I was able to solve the problem by pre processing the data to store the person’s timezone. Then using pytz I do this.

from django.utils import timezone 
import pytz


valid_timezones = []
for tz in list_of_timezones:
    local_time =  now().astimezone(pytz.timezone(tz))
    if 19 < local_time.hour < 20:
        valid_timezones.append(tz)

reminders = Person.objects.filter(timezone__in=valid_timezones)

solved How to filter Django queryset by non field values