2012-06-07 16:08:47 +00:00
|
|
|
from __future__ import unicode_literals
|
2009-01-29 10:46:36 +00:00
|
|
|
"""
|
2010-09-28 13:41:40 +00:00
|
|
|
Model for testing arithmetic expressions.
|
2009-01-29 10:46:36 +00:00
|
|
|
"""
|
2010-09-28 13:41:40 +00:00
|
|
|
from django.db import models
|
2009-01-29 10:46:36 +00:00
|
|
|
|
2011-10-13 18:51:33 +00:00
|
|
|
|
2009-01-29 10:46:36 +00:00
|
|
|
class Number(models.Model):
|
2009-01-30 20:02:42 +00:00
|
|
|
integer = models.IntegerField(db_column='the_integer')
|
|
|
|
float = models.FloatField(null=True, db_column='the_float')
|
2009-01-29 10:46:36 +00:00
|
|
|
|
|
|
|
def __unicode__(self):
|
2012-06-07 16:08:47 +00:00
|
|
|
return '%i, %.3f' % (self.integer, self.float)
|
2009-01-29 10:46:36 +00:00
|
|
|
|
2010-12-22 03:34:04 +00:00
|
|
|
class Experiment(models.Model):
|
|
|
|
name = models.CharField(max_length=24)
|
|
|
|
assigned = models.DateField()
|
|
|
|
completed = models.DateField()
|
|
|
|
start = models.DateTimeField()
|
|
|
|
end = models.DateTimeField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('name',)
|
|
|
|
|
|
|
|
def duration(self):
|
|
|
|
return self.end - self.start
|
|
|
|
|