

def date_extract_sql(self, lookup_type, field_name):
    if (lookup_type == 'week_day'):
        return ("EXTRACT('dow' FROM %s) + 1" % field_name)
    else:
        return ("EXTRACT('%s' FROM %s)" % (lookup_type, field_name))

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/db/backends/postgresql/operations.py DatabaseOperations.date_extract_sql/original