from apps.contacts.models import BaseContact


class ContactMixin(object):
    """
    Would be used for adding contacts functionality to models with contact data.
    """

    def get_contacts(self, is_primary=False):
        """
        Returns dict with all contacts.
        Example:
        >> obj.get_contacts()
        << {'email': [], 'skype': []}

        :param is_primary:
        :return:
        """
        subclasses = BaseContact.__subclasses__()
        results = {}
        for cls in subclasses:
            queryset = cls.objects.filter(employee_id=self.id)
            key, verbose = cls.CONTACT_EXTRA_DATA
            if is_primary:
                queryset = queryset.filter(is_primary=True)
            results.setdefault(key, queryset)
        return results

from apps.contacts.models import BaseContact


class ContactMixin(object):
    """
    Would be used for adding contacts functionality to models with contact data.
    """

    def get_contacts(self, is_primary=False):
        """
        Returns dict with all contacts.
        Example:
        >> obj.get_contacts()
        << {'email': [], 'skype': []}

        :param is_primary: bool Return only primary contacts.
        :return: dict
        """
        subclasses = BaseContact.__subclasses__()
        results = {}
        for cls in subclasses:
            queryset = cls.objects.filter(employee_id=self.id)
            key, verbose = cls.CONTACT_EXTRA_DATA
            if is_primary:
                queryset = queryset.filter(is_primary=True)
            results.setdefault(key, queryset)
        return results

Fix description for contact mixin
Fix description for contact mixin

  from apps.contacts.models import BaseContact
  
  
  class ContactMixin(object):
      """
      Would be used for adding contacts functionality to models with contact data.
      """
  
      def get_contacts(self, is_primary=False):
          """
          Returns dict with all contacts.
          Example:
          >> obj.get_contacts()
          << {'email': [], 'skype': []}
  
-         :param is_primary:
+         :param is_primary: bool Return only primary contacts.
-         :return:
+         :return: dict
          """
          subclasses = BaseContact.__subclasses__()
          results = {}
          for cls in subclasses:
              queryset = cls.objects.filter(employee_id=self.id)
              key, verbose = cls.CONTACT_EXTRA_DATA
              if is_primary:
                  queryset = queryset.filter(is_primary=True)
              results.setdefault(key, queryset)
          return results
  
Fix description for contact mixin
## Code Before:
from apps.contacts.models import BaseContact


class ContactMixin(object):
    """
    Would be used for adding contacts functionality to models with contact data.
    """

    def get_contacts(self, is_primary=False):
        """
        Returns dict with all contacts.
        Example:
        >> obj.get_contacts()
        << {'email': [], 'skype': []}

        :param is_primary:
        :return:
        """
        subclasses = BaseContact.__subclasses__()
        results = {}
        for cls in subclasses:
            queryset = cls.objects.filter(employee_id=self.id)
            key, verbose = cls.CONTACT_EXTRA_DATA
            if is_primary:
                queryset = queryset.filter(is_primary=True)
            results.setdefault(key, queryset)
        return results

## Instruction:
Fix description for contact mixin
## Code After:
from apps.contacts.models import BaseContact


class ContactMixin(object):
    """
    Would be used for adding contacts functionality to models with contact data.
    """

    def get_contacts(self, is_primary=False):
        """
        Returns dict with all contacts.
        Example:
        >> obj.get_contacts()
        << {'email': [], 'skype': []}

        :param is_primary: bool Return only primary contacts.
        :return: dict
        """
        subclasses = BaseContact.__subclasses__()
        results = {}
        for cls in subclasses:
            queryset = cls.objects.filter(employee_id=self.id)
            key, verbose = cls.CONTACT_EXTRA_DATA
            if is_primary:
                queryset = queryset.filter(is_primary=True)
            results.setdefault(key, queryset)
        return results
