Last active
October 12, 2024 21:12
-
-
Save matheusho/7913118 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import datetime | |
from datetime import date, timedelta | |
# date.today() returns the current date | |
# timedelta(days=X) takes the "days" attribute to subtract days from the current date | |
date = date.today() - timedelta(days=30) | |
# The "__gte" lookup search finds records where the date | |
# is greater than or equal to the comparison value | |
object_list = Model.objects.filter(date_at__gte=date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Corretíssimo, Vinícius! Falta de atenção no uso do lookup. Corrigido!