summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Ates <mates@entrouvert.com>2016-01-22 14:58:59 (GMT)
committerMikaël Ates <mates@entrouvert.com>2016-01-22 14:58:59 (GMT)
commit24d09bd5fa2fc0458af0b35292484bcb96875238 (patch)
treeaeaaa64f6975cf52554fdcacbc20020dcd7495bc
parenteb23c0e1a20fac8493260f1c4e6179e5144fdacf (diff)
downloadbiomon-24d09bd5fa2fc0458af0b35292484bcb96875238.zip
biomon-24d09bd5fa2fc0458af0b35292484bcb96875238.tar.gz
biomon-24d09bd5fa2fc0458af0b35292484bcb96875238.tar.bz2
Add a model for rfid readers.
-rw-r--r--src/biomon/models.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/biomon/models.py b/src/biomon/models.py
index 5483e21..7c0bd39 100644
--- a/src/biomon/models.py
+++ b/src/biomon/models.py
@@ -168,6 +168,21 @@ class Room(TimestampedAbstractModel):
return self.number
+class Reader(TimestampedAbstractModel):
+ ip_address = models.IPAddressField()
+ management_port = models.IntegerField()
+ room = models.OneToOneField('Room', verbose_name = _(u'Room'),
+ null=True, blank=True, on_delete=models.PROTECT)
+
+ @property
+ def first_letter(self):
+ return self.room and self.room.number[0].upper() or ''
+
+ def __unicode__(self):
+ return "{} {} {}:{}".format(_(u'Reader'), self.id, self.ip_address,
+ self.management_port)
+
+
class MetricCheck(TimestampedAbstractModel):
patient = models.ForeignKey(Patient, verbose_name=_(u'Patient'))
date = models.DateField(_(u'Date of check'))