Esempio n. 1
0
class CPEFilter(django_filters.FilterSet):
    cpe = filters.MultiValueFilter(name='cpe')
    description = filters.MultiValueFilter(name='description')

    class Meta:
        model = CPE
        fields = ('cpe', 'description')
class PartnerFilterSet(django_filters.FilterSet):
    enabled = filters.CaseInsensitiveBooleanFilter()
    binary = filters.CaseInsensitiveBooleanFilter()
    source = filters.CaseInsensitiveBooleanFilter()
    name = django_filters.CharFilter(lookup_type='icontains')
    type = django_filters.CharFilter(name='type__name')
    short = filters.MultiValueFilter(name='short')
    ftp_dir = filters.MultiValueFilter(name='ftp_dir')
    rsync_dir = filters.MultiValueFilter(name='rsync_dir')
    compose_arches = filters.MultiValueFilter(name='compose_arches__name')
    errata_packages = filters.MultiValueFilter(name='errata_packages__name')

    class Meta:
        model = models.Partner
        fields = (
            'short',
            'name',
            'type',
            'enabled',
            'binary',
            'source',
            'ftp_dir',
            'rsync_dir',
            'compose_arches',
            'errata_packages',
        )
Esempio n. 3
0
class ReleaseVariantCPEFilter(django_filters.FilterSet):
    release = filters.MultiValueFilter(name='variant__release__release_id')
    variant_uid = filters.MultiValueFilter(name='variant__variant_uid')
    cpe = filters.MultiValueFilter(name='cpe')

    class Meta:
        model = VariantCPE
        fields = ('release', 'variant_uid', 'cpe')
class ProductFilter(django_filters.FilterSet):
    active = ActiveReleasesFilter(name='productversion__release')
    name = filters.MultiValueFilter(name='name')
    short = filters.MultiValueFilter(name='short')

    class Meta:
        model = Product
        fields = ('name', 'short', 'active')
Esempio n. 5
0
class BaseProductFilter(django_filters.FilterSet):
    short = filters.MultiValueFilter(name='short')
    version = filters.MultiValueFilter(name='version')
    name = filters.MultiValueFilter(name='name')
    base_product_id = filters.MultiValueFilter(name='base_product_id')

    class Meta:
        model = BaseProduct
        fields = ("base_product_id", "short", "version", 'name')
Esempio n. 6
0
class ReleaseGroupFilter(django_filters.FilterSet):
    name = filters.MultiValueFilter(name='name')
    description = filters.MultiValueFilter(name='description')
    type = filters.MultiValueFilter(name='type__name')
    releases = filters.MultiValueFilter(name='releases__release_id')
    active = filters.CaseInsensitiveBooleanFilter()

    class Meta:
        model = ReleaseGroup
        fields = ('name', 'description', 'type', 'releases', 'active')
class ProductVersionFilter(django_filters.FilterSet):
    active = ActiveReleasesFilter(name='release')
    short = filters.MultiValueFilter(name='short')
    version = filters.MultiValueFilter(name='version')
    name = filters.MultiValueFilter(name='name')
    product_version_id = filters.MultiValueFilter(name='product_version_id')

    class Meta:
        model = ProductVersion
        fields = ('name', 'product_version_id', 'version', 'short', 'active')
class ReleaseVariantFilter(django_filters.FilterSet):
    release = filters.MultiValueFilter(name='release__release_id')
    id = filters.MultiValueFilter(name='variant_id')
    uid = filters.MultiValueFilter(name='variant_uid')
    name = filters.MultiValueFilter(name='variant_name')
    type = filters.MultiValueFilter(name='variant_type__name')

    class Meta:
        model = Variant
        fields = ('release', 'id', 'uid', 'name', 'type')
class ReleaseFilter(django_filters.FilterSet):
    release_id = filters.MultiValueFilter(name='release_id')
    base_product = filters.MultiValueFilter(name='base_product__base_product_id')
    has_base_product = django_filters.CharFilter(method='find_has_base_product')
    release_type = filters.MultiValueFilter(name='release_type__short')
    product_version = filters.MultiValueFilter(name='product_version__product_version_id')
    integrated_with = filters.NullableCharFilter(name='integrated_with__release_id')
    active = filters.CaseInsensitiveBooleanFilter()
    name = filters.MultiValueFilter(name='name')
    short = filters.MultiValueFilter(name='short')
    version = filters.MultiValueFilter(name='version')
    sigkey = filters.MultiValueFilter(name='sigkey__key_id')
    allow_buildroot_push = filters.CaseInsensitiveBooleanFilter()
    allowed_debuginfo_services = filters.MultiValueFilter(name='allowed_debuginfo_services__name')
    allowed_push_targets = AllowedPushTargetsFilter(['product_version'])

    class Meta:
        model = Release
        fields = ("release_id", "name", "short", "version", 'product_version',
                  "release_type", "base_product", 'active', 'integrated_with',
                  'sigkey', 'allow_buildroot_push', 'allowed_debuginfo_services',
                  'allowed_push_targets')

    def find_has_base_product(self, queryset, name, value, *args, **kwargs):
        """
        Make it possible to filter releases if base_product is null or not.
        """
        if value == 'True':
            return queryset.filter(base_product__isnull=False).distinct()
        elif value == 'False':
            return queryset.filter(base_product__isnull=True).distinct()
        return queryset
Esempio n. 10
0
class PartnerMappingFilterSet(django_filters.FilterSet):
    partner = filters.MultiValueFilter(name='partner__short')
    release = filters.MultiValueFilter(
        name='variant_arch__variant__release__release_id')
    variant = filters.MultiValueFilter(
        name='variant_arch__variant__variant_uid')
    arch = filters.MultiValueFilter(name='variant_arch__arch__name')

    class Meta:
        model = models.PartnerMapping
        fields = ('partner', 'release', 'variant', 'arch')
Esempio n. 11
0
class ReleaseTypeFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type="icontains")
    short = filters.MultiValueFilter(name='short')

    class Meta:
        model = ReleaseType
        fields = ('name', 'short')
Esempio n. 12
0
class ReleaseFilter(django_filters.FilterSet):
    release_id = filters.MultiValueFilter(name='release_id')
    base_product = filters.MultiValueFilter(
        name='base_product__base_product_id')
    has_base_product = django_filters.MethodFilter(
        action='find_has_base_product')
    release_type = filters.MultiValueFilter(name='release_type__short')
    product_version = filters.MultiValueFilter(
        name='product_version__product_version_id')
    integrated_with = filters.NullableCharFilter(
        name='integrated_with__release_id')
    active = filters.CaseInsensitiveBooleanFilter()
    name = filters.MultiValueFilter(name='name')
    short = filters.MultiValueFilter(name='short')
    version = filters.MultiValueFilter(name='version')

    class Meta:
        model = Release
        fields = ("release_id", "name", "short", "version", 'product_version',
                  "release_type", "base_product", 'active', 'integrated_with')

    def find_has_base_product(self, queryset, value, *args, **kwargs):
        """
        Make it possible to filter releases if base_product is null or not.
        """
        if value == 'True':
            return queryset.filter(base_product__isnull=False).distinct()
        elif value == 'False':
            return queryset.filter(base_product__isnull=True).distinct()
        return queryset
class ReleaseVariantFilter(django_filters.FilterSet):
    release = filters.MultiValueFilter(name='release__release_id')
    id      = filters.MultiValueFilter(name='variant_id')
    uid     = filters.MultiValueFilter(name='variant_uid')
    name    = filters.MultiValueFilter(name='variant_name')
    type    = filters.MultiValueFilter(name='variant_type__name')
    variant_version = filters.MultiValueFilter(name='variant_version')
    variant_release = filters.MultiValueFilter(name='variant_release')
    allowed_push_targets = AllowedPushTargetsFilter(['release', 'product_version'])

    class Meta:
        model = Variant
        fields = ('release', 'id', 'uid', 'name', 'type', 'allowed_push_targets')