H
H
homm2010-11-25 17:25:11
Django
homm, 2010-11-25 17:25:11

Any alternatives to django-timezones?

I found a module for working with dates tied to time zones.
The author thought it out well (in terms of functionality, it suits me), but it seems that he never used it in practice. Because it is full of bugs, including no mysql support, and it alone is capable of generating hundreds of queries per page.
There are, of course, different forks , but none of them essentially corrects the situation.
So the question is, is there another common way to work with dates tied to time zones for Django?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
elky, 2010-11-25
@elky

Take a look at this: Django and Time Zones

K
kmike, 2010-11-26
@kmike

I use django-timezones like this:

class City(models.Model):
    name = models.CharField(u'City', max_length=30)
    timezone = TimeZoneField(u'timezone')

    def now(self):
        return datetime.now(self.timezone).replace(tzinfo=None)

And then, knowing the current time in the city, you can already carry out any necessary calculations - just use something like self.city.now() instead of datetime.now().
All the extra bells and whistles from django-timezones didn't seem very useful, I didn't figure out how to use them - the devil is in the details, as usual. Additional calculations can be done using standard datetime or/and third party dateutil.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question