How can I filter the model data according to date range of two columns - birthday
and anniversary
which are datefield
s using Django querysets?
This is in a function that is called every friday. So the date range will be from tomorrow i.e., Saturday to next Friday.
def mailer_function():
model_data = Model.objects.filter(
birthday__range=["tomorrow(i.e., Saturday's date)", "next friday's date"],
anniversary__range=["tomorrow(i.e., Saturday's date)", "next friday's date"]
)
Here I should get the model_data whose birthday or anniversary dates are in the next week.