Using DateTimeRangeField in Django
Posted on 2021-04-06 in Trucs et astuces • Tagged with Django, Python, PostgreSQL
The basics
If you need to store a datetime range in Django (for instance from which day to which day a listing is valid), instead of relying on two fields like valid_from and valid_to, you can use a single field validity_range of type DateRangeField. This way, both values are stored …
Continue reading