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
Example #3
0
class SampleModelUSA(models.Model):
    phone = FullPhoneDbField(default_code='1')
Example #4
0
class SampleModel(models.Model):
    phone = FullPhoneDbField()
Example #5
0
class SampleModelBlank(models.Model):
    phone = FullPhoneDbField(blank=True)