コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
    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)
コード例 #4
0
class Version(models.Model):
    service = models.ForeignKey('core.Service')
    number = semver_fields.VersionField()
    api_version = models.TextField()
コード例 #5
0
 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)
コード例 #6
0
 class VersionModel(models.Model):
     version = semver_fields.VersionField(verbose_name='my version')
     spec = semver_fields.SpecField(verbose_name='my spec')
コード例 #7
0
 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')