Skip to content

Instantly share code, notes, and snippets.

@matheusho
Last active October 30, 2017 14:44
Show Gist options
  • Save matheusho/7913118 to your computer and use it in GitHub Desktop.
Save matheusho/7913118 to your computer and use it in GitHub Desktop.
# Import datetime
from datetime import date
today = datetime.today()
date = date.fromordinal(today.toordinal() - 30) # today - 30 days
object_list = Model.objects.filter(date_at__gte=date)
@matheusho
Copy link
Author

matheusho commented Dec 11, 2013

Corretíssimo, Vinícius! Falta de atenção no uso do lookup. Corrigido!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment