(cls, direction, domain=None)
return None
Gets the most specific criteria available based on (and in order of preference for optional):
        - direction
        - domain (optional)
Gets the most specific criteria available based on (and in order of preference for optional):
        - direction
        - domain (optional)
Gets the most specific criteria available based on ( and in order of preference for optional ) : - direction - domain ( optional )
def get_most_specific(cls, direction, domain=None):
        """
        Gets the most specific criteria available based on (and in order of preference for optional):
        - direction
        - domain (optional)
        """
        all_possible_criteria = cls.objects.filter(direction=direction)

        if all_possible_criteria.count() == 0:
            return None

        try:
            return all_possible_criteria.get(domain=domain)
        except cls.DoesNotExist:
            pass
        try:
            return all_possible_criteria.get(domain=None)
        except cls.DoesNotExist:
            pass

        return None
def get_most_specific ( cls , direction , domain = None ) : all_possible_criteria = cls . objects . filter ( direction = direction ) if all_possible_criteria . count ( ) == 0 : return None try : return all_possible_criteria . get ( domain = domain ) except cls . DoesNotExist : pass try : return all_possible_criteria . get ( domain = None ) except cls . DoesNotExist : pass return None