Reputation: 13329
Im trying to use the filter week_day as documented here
week_day¶
For date and datetime fields, a ‘day of the week’ match. Allows chaining additional field lookups. Takes an integer value representing the day of week from 1 (Sunday) to 7 (Saturday).
entries = Booking.objects.filter(date__week_day__gte=2)
But this gives me the error:
Unsupported lookup 'week_day' for DateField or join on the field not permitted.
How come this does not work? The documentations shows it there..
Upvotes: 0
Views: 1697
Reputation: 20539
There are not so many week days and lookup week_day__gte
, as mentioned in Alasdair answer, is not available yet.
To solve that problem, you can specify each week day separately:
import operator
entries = Booking.objects.filter(reduce(operator.or_, [Q(date__week_day__gte=weekday) for weekday in [2, 3, 4, 5, 6, 7]]))
Upvotes: 2
Reputation: 308829
Using week_day__gte
will be available in Django 1.9, but it is not possible in Django 1.8. You linked to the development docs, the 1.8 docs are here.
Upvotes: 3