1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
from django.db import models
from timescale.db.models.fields import TimescaleDateTimeField
from timescale.db.models.managers import TimescaleManager
class TimescaleModel(models.Model):
"""
A helper class for using Timescale within Django, has the TimescaleManager and
TimescaleDateTimeField already present. This is an abstract class it should
be inheritted by another class for use.
"""
time = TimescaleDateTimeField(interval="1 day")
objects = models.Manager()
timescale = TimescaleManager()
class Meta:
abstract = True
|