Exemplo n.º 1
0
class ParchmentIntake(models.Model):
    supervisor = models.ForeignKey(Employee,
                                   on_delete=models.SET_NULL,
                                   null=True)
    supplier = models.ForeignKey(Supplier,
                                 on_delete=models.SET_NULL,
                                 null=True)

    total_bags_count = models.FloatField()
    total_weight = models.FloatField()
    moisture_content = models.FloatField(default=0.00)
    sample_result = models.FloatField(default=0.00)

    resting_period = models.IntegerField()

    supervisor_signature = JSignatureField(null=True, blank=True)

    delivery_person_name = models.CharField(max_length=60,
                                            null=True,
                                            blank=True)
    delivery_person_signature = JSignatureField(null=True, blank=True)

    created_date = models.DateField(default=timezone.now)

    signed_delivery_slip = models.FileField(upload_to=f'delivery-slips')
    delivery_person_pic = models.FileField(upload_to=f'delivery-persons')

    marker_placed = models.BooleanField(default=False)
    intake_note = models.TextField(null=True, blank=True)

    def _str__(self):
        return str(self.id)
Exemplo n.º 2
0
 def test_get_prep_value_correct_values_json(self):
     f = JSignatureField()
     val = [{"x": [1, 2], "y": [3, 4]}]
     val_str = '[{"x":[1,2], "y":[3,4]}]'
     val_prep = f.get_prep_value(val_str)
     self.assertIsInstance(val_prep, six.string_types)
     self.assertEquals(val, json.loads(val_prep))
Exemplo n.º 3
0
class Firma(models.Model):
    sesion = models.ForeignKey('cabina.Sesion', on_delete=models.CASCADE)
    firma = JSignatureField(blank=True, null=True)

    objects = models.Manager()

    def __str__(self):
        return ''
Exemplo n.º 4
0
class Intake(models.Model):
    supervisor_name = models.CharField(max_length=60)
    lot_location = models.ForeignKey(Location,
                                     on_delete=models.SET_NULL,
                                     null=True)
    is_floated = models.BooleanField(default=False, blank=True, null=True)
    total_box_count = models.FloatField()
    passed_float_box_count = models.FloatField(default=0.00,
                                               null=True,
                                               blank=True)

    supervisor_signature = JSignatureField(null=True, blank=True)
    supplier_name = models.ForeignKey(Supplier,
                                      on_delete=models.SET_NULL,
                                      null=True)
    representative_name = models.CharField(max_length=60,
                                           null=True,
                                           blank=True)
    representative_signature = JSignatureField(null=True, blank=True)
    is_external = models.BooleanField(default=False)
    created_date = models.DateField(default=timezone.now)

    def _str__(self):
        return str(self.id)
Exemplo n.º 5
0
 def test_formfield(self):
     f = JSignatureField()
     cls = f.formfield().__class__
     self.assertTrue(issubclass(cls, JSignatureFormField))
Exemplo n.º 6
0
 def test_get_prep_value_incorrect_values(self):
     f = JSignatureField()
     val = type('Foo')
     self.assertRaises(ValidationError, f.get_prep_value, val)
Exemplo n.º 7
0
 def test_get_prep_value_empty(self):
     f = JSignatureField()
     for val in ['', [], '[]']:
         self.assertIsNone(f.get_prep_value(val))
Exemplo n.º 8
0
 def test_from_db_value_incorrect_value(self):
     f = JSignatureField()
     val = 'foo'
     self.assertRaises(ValidationError, f.from_db_value, val)
Exemplo n.º 9
0
 def test_from_db_value_correct_value_json(self):
     f = JSignatureField()
     val = [{"x": [1, 2], "y": [3, 4]}]
     val_str = '[{"x":[1,2], "y":[3,4]}]'
     self.assertEquals(val, f.from_db_value(val_str))
Exemplo n.º 10
0
 def test_from_db_value_correct_value_python(self):
     f = JSignatureField()
     val = [{"x": [1, 2], "y": [3, 4]}]
     self.assertEquals(val, f.from_db_value(val))
Exemplo n.º 11
0
 def test_from_db_value_empty(self):
     f = JSignatureField()
     for val in ['', [], '[]']:
         self.assertIsNone(f.from_db_value(val))
Exemplo n.º 12
0
 def test_to_python_incorrect_value(self):
     f = JSignatureField()
     val = 'foo'
     self.assertRaises(ValidationError, f.to_python, val)
Exemplo n.º 13
0
 def test_to_python_correct_value_json(self):
     f = JSignatureField()
     val = [{"x": [1, 2], "y": [3, 4]}]
     val_str = '[{"x":[1,2], "y":[3,4]}]'
     self.assertEquals(val, f.to_python(val_str))
Exemplo n.º 14
0
 def test_to_python_empty(self):
     f = JSignatureField()
     for val in ['', [], '[]']:
         self.assertIsNone(f.to_python(val))