import django_filters

from .models import Deployment


class DeploymentFilter(django_filters.FilterSet):
    db_name = django_filters.CharFilter()
    state = django_filters.CharFilter()

    class Meta(object):
        model = Deployment
        fields = [
            'db_name',
            'state',
        ]
        order_by = [
            'state',
            # desc
            '-state',
        ]

import django_filters

from nodeconductor.structure.filters import BaseResourceStateFilter
from .models import Deployment


class DeploymentFilter(BaseResourceStateFilter):
    db_name = django_filters.CharFilter()

    class Meta(BaseResourceStateFilter.Meta):
        model = Deployment
        fields = [
            'db_name',
            'state',
        ]
        order_by = [
            'state',
            # desc
            '-state',
        ]

Use generic state filter instead of custom one
Use generic state filter instead of custom one

- ITACLOUD-6837

  import django_filters
  
+ from nodeconductor.structure.filters import BaseResourceStateFilter
  from .models import Deployment
  
  
- class DeploymentFilter(django_filters.FilterSet):
+ class DeploymentFilter(BaseResourceStateFilter):
      db_name = django_filters.CharFilter()
-     state = django_filters.CharFilter()
  
-     class Meta(object):
+     class Meta(BaseResourceStateFilter.Meta):
          model = Deployment
          fields = [
              'db_name',
              'state',
          ]
          order_by = [
              'state',
              # desc
              '-state',
          ]
  
Use generic state filter instead of custom one
## Code Before:
import django_filters

from .models import Deployment


class DeploymentFilter(django_filters.FilterSet):
    db_name = django_filters.CharFilter()
    state = django_filters.CharFilter()

    class Meta(object):
        model = Deployment
        fields = [
            'db_name',
            'state',
        ]
        order_by = [
            'state',
            # desc
            '-state',
        ]

## Instruction:
Use generic state filter instead of custom one
## Code After:
import django_filters

from nodeconductor.structure.filters import BaseResourceStateFilter
from .models import Deployment


class DeploymentFilter(BaseResourceStateFilter):
    db_name = django_filters.CharFilter()

    class Meta(BaseResourceStateFilter.Meta):
        model = Deployment
        fields = [
            'db_name',
            'state',
        ]
        order_by = [
            'state',
            # desc
            '-state',
        ]
