python - Selecting a model by a timezone attached to it in django -
python - Selecting a model by a timezone attached to it in django -
imagine have 2 models so:
time(models.model): time = models.timefield() model(models.model): time = models.foreignkey(time) timezone = models.charfield() now, filter these models based on utc time. raw sql this:
select * model left bring together time on model.time_id = time.id time = '01:00:00' @ time zone model.timezone however, there's massive , complicated assortment of other filters can filtered on depend on using django orm rather total raw sql query. there convenient way can utilize raw sql part of query?
python sql django orm django-orm
Comments
Post a Comment