django-planet

Feed: Clivern

Blog Django | Clivern
RSS 2.0 Feed Clivern
web https://clivern.com
Last Update12.20.2024
Posts3

Adding a Unique Request ID to Each Request in Django

May 23, 2020 » Clivern » [Archived Version]

You can do that in Django using a middleware. The middleware needs to generate a unique request id (e.g. using UUID) and associate that id with the request. First way is to attach that id to the request.META in the middleware. the only problem is that you have to fetch that id from the request […] The post Adding a Unique Request ID to Each Request in Django first appeared on Clivern.

Read More

Django Custom Month and Year Lookup

April 27, 2019 » Clivern » [Archived Version]

Everyone want to keep Django timezone support but sometimes you need to keep your SQL queries a way from timezone conversion especially if by default your application timezone is UTC. Django will do something like this CONVERT_TZ(`app_incident`.`datetime`, 'UTC', 'UTC')) and it will return Null if the timezone table is empty. Even that conversion is not […] The post Django Custom Month and Year Lookup first appeared on Clivern.

Read More

Django Custom Lookups

April 23, 2019 » Clivern » [Archived Version]

By default Django has a date lookup that support timezones. It actually will wrap your field with CONVERT_TZ in case USE_TZ is True. This is pretty awesome unless you have timezones table empty because this call will return Null. But even the following will work, It is not safe with Daylight saving timing. You can […] The post Django Custom Lookups first appeared on Clivern.

Read More