def test_deconstruct_default():
    """
    Test field deconstruction (when no arguments passed)
    """
    original = FullPhoneDbField()
    name, path, args, kwargs = original.deconstruct()

    copy = FullPhoneDbField(*args, **kwargs)

    assert original.validator_options == copy.validator_options
    assert original.max_length == copy.max_length
def test_deconstruct():
    """
    Test field deconstruction
    """
    original = FullPhoneDbField(default='1',
                                max_phone_length=8,
                                min_phone_length=1)
    name, path, args, kwargs = original.deconstruct()

    copy = FullPhoneDbField(*args, **kwargs)

    assert original.validator_options == copy.validator_options
    assert original.max_length == copy.max_length
Ejemplo n.º 3
0
class SampleModelUSA(models.Model):
    phone = FullPhoneDbField(default_code='1')
Ejemplo n.º 4
0
class SampleModel(models.Model):
    phone = FullPhoneDbField()
Ejemplo n.º 5
0
class SampleModelBlank(models.Model):
    phone = FullPhoneDbField(blank=True)