class PartialVersionModel(models.Model): partial = semver_fields.VersionField(partial=True, verbose_name='partial version') optional = semver_fields.VersionField(verbose_name='optional version', blank=True, null=True) optional_spec = semver_fields.SpecField(verbose_name='optional spec', blank=True, null=True)
def test_version_field(self): field = django_fields.VersionField( partial=True, coerce=True, ) expected = { 'coerce': True, 'partial': True, 'max_length': 200, } self.assertEqual(field.deconstruct()[3], expected)
def test_version_field(self): field = django_fields.VersionField( partial=True, coerce=True, ) expected = { 'coerce': True, 'partial': True, 'max_length': 200, } if hasattr(sys, 'pypy_version_info'): # Django under Pypy adds this extra key. expected['help_text'] = u'' self.assertEqual(field.deconstruct()[3], expected)
class Version(models.Model): service = models.ForeignKey('core.Service') number = semver_fields.VersionField() api_version = models.TextField()
class CoerceVersionModel(models.Model): version = semver_fields.VersionField(verbose_name='my version', coerce=True) partial = semver_fields.VersionField(verbose_name='partial version', coerce=True, partial=True)
class VersionModel(models.Model): version = semver_fields.VersionField(verbose_name='my version') spec = semver_fields.SpecField(verbose_name='my spec')
class VersionModel(models.Model): version = semver_fields.VersionField(verbose_name='my version') spec = semver_fields.SpecField(verbose_name='my spec') npm_spec = semver_fields.SpecField(syntax='npm', blank=True, verbose_name='npm spec')