##// END OF EJS Templates
Fix utc time handling
Fix utc time handling

File last commit:

r39:b80dda8fb07c
r44:74ffee4b5884
Show More
models.py
40 lines | 982 B | text/x-python | PythonLexer
# -*- coding: utf-8 -*-
from django.db import models
from mongoengine import Document, IntField, FloatField, StringField, DictField, ListField, DateTimeField, ReferenceField
class Experiment(Document):
code = IntField(unique=True)
name = StringField(max_length=40)
class ExpDetail(Document):
experiment = ReferenceField(Experiment)
date = DateTimeField()
last_time = FloatField()
interval = IntField()
tag = StringField(max_length=40)
def plots(self):
return PlotMeta.objects(exp_detail=self)
class PlotMeta(Document):
exp_detail = ReferenceField(ExpDetail)
metadata = DictField()
plot = StringField()
class PlotData(Document):
plot = ReferenceField(PlotMeta)
time = FloatField()
data = ListField()
meta = {
'indexes': ["plot", "+time"]
}
class Exp(models.Model):
name = models.CharField(max_length=60)
code = models.IntegerField()
def __str__(self):
return self.name