Skip to content

Instantly share code, notes, and snippets.

@matheusho
Last active October 30, 2017 14:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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)
@vbmendes
Copy link

Matheus, acho que você trocou o lookup do seu filtro. Não seria __gte?

@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