2012-06-07 18:08:47 +02:00
|
|
|
from __future__ import unicode_literals
|
2012-08-12 12:32:08 +02:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2009-01-29 11:46:36 +01:00
|
|
|
"""
|
2010-09-28 15:41:40 +02:00
|
|
|
Model for testing arithmetic expressions.
|
2009-01-29 11:46:36 +01:00
|
|
|
"""
|
2010-09-28 15:41:40 +02:00
|
|
|
from django.db import models
|
2009-01-29 11:46:36 +01:00
|
|
|
|
2011-10-13 20:51:33 +02:00
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
@python_2_unicode_compatible
|
2009-01-29 11:46:36 +01:00
|
|
|
class Number(models.Model):
|
2013-02-21 23:02:18 +01:00
|
|
|
integer = models.BigIntegerField(db_column='the_integer')
|
2009-01-30 21:02:42 +01:00
|
|
|
float = models.FloatField(null=True, db_column='the_float')
|
2009-01-29 11:46:36 +01:00
|
|
|
|
2012-08-12 12:32:08 +02:00
|
|
|
def __str__(self):
|
2012-06-07 18:08:47 +02:00
|
|
|
return '%i, %.3f' % (self.integer, self.float)
|
2009-01-29 11:46:36 +01:00
|
|
|
|
2013-11-03 05:36:09 +01:00
|
|
|
|
2010-12-22 04:34:04 +01: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
|