import django_filters

from nodeconductor.core.filters import UUIDFilter

from . import models


class PackageTemplateFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    settings_uuid = UUIDFilter(name='service_settings__uuid')

    class Meta(object):
        model = models.PackageTemplate
        fields = ('name', 'settings_uuid',)


class OpenStackPackageFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    settings_uuid = UUIDFilter(name='service_settings__uuid')

    class Meta(object):
        model = models.OpenStackPackage
        fields = ('name', 'settings_uuid',)

import django_filters

from nodeconductor.core.filters import UUIDFilter

from . import models


class PackageTemplateFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    settings_uuid = UUIDFilter(name='service_settings__uuid')

    class Meta(object):
        model = models.PackageTemplate
        fields = ('name', 'settings_uuid',)


class OpenStackPackageFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    customer = UUIDFilter(name='tenant__service_project_link__project__customer')
    project = UUIDFilter(name='tenant__service_project_link__project')

    class Meta(object):
        model = models.OpenStackPackage
        fields = ('name', 'customer', 'project')

Enable filtering OpenStack package by customer and project (WAL-49)
Enable filtering OpenStack package by customer and project (WAL-49)

  import django_filters
  
  from nodeconductor.core.filters import UUIDFilter
  
  from . import models
  
  
  class PackageTemplateFilter(django_filters.FilterSet):
      name = django_filters.CharFilter(lookup_type='icontains')
      settings_uuid = UUIDFilter(name='service_settings__uuid')
  
      class Meta(object):
          model = models.PackageTemplate
          fields = ('name', 'settings_uuid',)
  
  
  class OpenStackPackageFilter(django_filters.FilterSet):
      name = django_filters.CharFilter(lookup_type='icontains')
-     settings_uuid = UUIDFilter(name='service_settings__uuid')
+     customer = UUIDFilter(name='tenant__service_project_link__project__customer')
+     project = UUIDFilter(name='tenant__service_project_link__project')
  
      class Meta(object):
          model = models.OpenStackPackage
-         fields = ('name', 'settings_uuid',)
+         fields = ('name', 'customer', 'project')
  
Enable filtering OpenStack package by customer and project (WAL-49)
## Code Before:
import django_filters

from nodeconductor.core.filters import UUIDFilter

from . import models


class PackageTemplateFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    settings_uuid = UUIDFilter(name='service_settings__uuid')

    class Meta(object):
        model = models.PackageTemplate
        fields = ('name', 'settings_uuid',)


class OpenStackPackageFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    settings_uuid = UUIDFilter(name='service_settings__uuid')

    class Meta(object):
        model = models.OpenStackPackage
        fields = ('name', 'settings_uuid',)

## Instruction:
Enable filtering OpenStack package by customer and project (WAL-49)
## Code After:
import django_filters

from nodeconductor.core.filters import UUIDFilter

from . import models


class PackageTemplateFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    settings_uuid = UUIDFilter(name='service_settings__uuid')

    class Meta(object):
        model = models.PackageTemplate
        fields = ('name', 'settings_uuid',)


class OpenStackPackageFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(lookup_type='icontains')
    customer = UUIDFilter(name='tenant__service_project_link__project__customer')
    project = UUIDFilter(name='tenant__service_project_link__project')

    class Meta(object):
        model = models.OpenStackPackage
        fields = ('name', 'customer', 'project')
