[Fixed]-How can I query django models using modulo?

1👍

Another way of doing a queryset that could work for you:

from datetime import timedelta
from datetime import datetime

to_compare_datetime = datetime.now() - timedelta(days=180)
members = Member.objects.filter(account_activated=False, created__year=to_compare_datetime.year, created__month=to_compare_datetime.month, created__day=to_compare_datetime.day)

I’m supposing that your Member model has a field account_activated, and that the created field is a DateTimeField. Hope this can help you 🙂

Leave a comment