I tried something like:
MyModel.objects.filter(year__week=1)
It doesn't work. For now, I calculate the first day and the last day of the week and then use gte and lte, but it's less than efficient given that SQL comes with a Week function.
I tried something like:
MyModel.objects.filter(year__week=1)
It doesn't work. For now, I calculate the first day and the last day of the week and then use gte and lte, but it's less than efficient given that SQL comes with a Week function.
It seems that django DateField doesn't have week attribute, as weel as date object from Python. They have both year and month and also day, but not week attribute. I guess you need to translate week to day range and file a ticket on django website ;-)