2012-06-07 16:08:47 +00:00
|
|
|
from __future__ import unicode_literals
|
2012-08-12 10:32:08 +00:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
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
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
@python_2_unicode_compatible
|
2009-01-29 10:46:36 +00:00
|
|
|
class Number(models.Model):
|
2013-02-21 22:02:18 +00:00
|
|
|
integer = models.BigIntegerField(db_column='the_integer')
|
2009-01-30 20:02:42 +00:00
|
|
|
float = models.FloatField(null=True, db_column='the_float')
|
2009-01-29 10:46:36 +00:00
|
|
|
|
2012-08-12 10:32:08 +00:00
|
|
|
def __str__(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
|