Hacker News new | past | comments | ask | show | jobs | submit login

Beware of using DateTimeField for anything which uses DateMixin - https://docs.djangoproject.com/en/1.5/ref/class-based-views/...

You can end up in a weird situation with 404s due to timezone settings. Our timezone is set to Europe/London, the get_absolute_url method for any objects between midnight and 1am BST returns the result for the wrong day. The object will still be visible, just not at the expected URL.

If you're using dates for URLs, add an additional DateField, set it to editable=False, add something in save() which sets the date based on the datetime, and use the date field for your get_absolute_url method.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: