Initial port to python3
[htsworkflow.git] / htsworkflow / frontend / bcmagic / models.py
1 from django.db import models
2
3 #FIXME: Should be made more generic and probably pre-populated supported list
4 #   but for now, since we only have a ZM400, this will do.
5 PRINTER_MODELS=[ ('Zebra ZM400', 'Zebra ZM400'),
6                  ('Zebra ZM600', 'Zebra ZM600')]
7
8 LABEL_SHAPES = [ ('Square', 'Square'), ('Circle', 'Circle') ]
9
10 class KeywordMap(models.Model):
11     """
12     Mapper object maps keyword|arg1|arg2|...|argN to REST urls
13     """
14     keyword = models.CharField(max_length=64)
15     regex = models.CharField(max_length=1024)
16     url_template = models.TextField()
17
18 class Printer(models.Model):
19     """
20     Barcode Printer Information
21     """
22     name = models.CharField(max_length=256)
23     model = models.CharField(max_length=64, choices=PRINTER_MODELS)
24     ip_address = models.IPAddressField()
25     label_shape = models.CharField(max_length=32, choices=LABEL_SHAPES)
26     label_width = models.FloatField(help_text='width or diameter in inches')
27     label_height = models.FloatField(help_text='height in inches')
28     notes = models.TextField()
29
30     def __unicode__(self):
31         return '%s, %s, %s, %s, %sx%s' % (self.name, self.model, self.ip_address, self.label_shape, self.label_width, self.label_width)