How to use the productmd.common.RELEASE_SHORT_RE.pattern function in productmd

To help you get started, we’ve selected a few productmd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github product-definition-center / product-definition-center / pdc / apps / release / models.py View on Github external
    @property
    def allowed_push_targets(self):
        return self._parent_allowed_push_targets().exclude(id__in=self.masked_push_targets.all())

    @allowed_push_targets.setter
    def allowed_push_targets(self, value):
        self.masked_push_targets = self._parent_allowed_push_targets().exclude(id__in=value)

    def _allowed_push_target_names(self):
        return [push_target.name for push_target in self.allowed_push_targets]


class ProductVersion(AllowedPushTargetsModel):
    name                = models.CharField(max_length=200)
    short = models.CharField(max_length=200, validators=[
        RegexValidator(regex=RELEASE_SHORT_RE.pattern, message='Only accept lowercase letters, numbers or -')])
    version             = models.CharField(max_length=200, validators=[
        RegexValidator(regex=RELEASE_VERSION_RE.pattern, message='Only accept comma separated numbers or any text')])
    product             = models.ForeignKey(Product, on_delete=models.CASCADE)
    product_version_id  = models.CharField(max_length=200)

    class Meta:
        unique_together = (("short", "version"))
        ordering = ("product_version_id", )

    def __unicode__(self):
        return self.product_version_id

    @property
    def active(self):
        return self.active_release_count > 0