Skip to content

Instantly share code, notes, and snippets.

View diptangsu's full-sized avatar
:octocat:
Don't forget to drink water

Diptangsu Goswami diptangsu

:octocat:
Don't forget to drink water
View GitHub Profile
@diptangsu
diptangsu / python_decorator_guide.md
Created January 17, 2019 17:32 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@diptangsu
diptangsu / views.py
Last active January 18, 2024 16:52 — forked from cansadadeserfeliz/views.py
Django: filter DatetimeField by today (max and min time)
# source: http://stackoverflow.com/questions/1317714/how-can-i-filter-a-date-of-a-datetimefield-in-django
from django.utils import timezone
today_min = datetime.combine(timezone.now().date(), datetime.today().time().min)
today_max = datetime.combine(timezone.now().date(), datetime.today().time().max)
objetcs_for_today = MyModel.objects.filter(date__range=(today_min, today_max))
@diptangsu
diptangsu / README-Template.md
Created December 18, 2017 16:42 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites