def assert_pks_uniqueness(self, pks, exclude, value):
        """Check uniqueness of pks

        Parameters
        -----------
        pks: iterable
            The pks to check for uniqueness. If more than one different,
            it will raise. If only one and different than `exclude`, it will
            raise too.
        exclude: str
            The pk that we accept to be the only one in `pks`. For example
            the pk of the instance we want to check for uniqueness: we don't
            want to raise if the value is the one already set for this instance
        value: any
            Only to be displayed in the error message.

        Raises
        ------
        UniquenessError
            - If at least two different pks
            - If only one pk that is not the `exclude` one

        """
        pks = list(set(pks))
        if len(pks) > 1:
            # this may not happen !
            raise UniquenessError(
                "Multiple values indexed for unique field %s.%s: %s" % (
                    self.model.__name__, self.field.name, pks
                )
            )
        elif len(pks) == 1 and (not exclude or pks[0] != exclude):
            self.connection.delete(self.field.key)
            raise UniquenessError(
                'Value "%s" already indexed for unique field %s.%s (for instance %s)' % (
                    self.normalize_value(value), self.model.__name__, self.field.name, pks[0]
                )
            )
def assert_pks_uniqueness ( self , pks , exclude , value ) : pks = list ( set ( pks ) ) if len ( pks ) > 1 : raise UniquenessError ( "Multiple values indexed for unique field %s.%s: %s" % ( self . model . __name__ , self . field . name , pks ) ) elif len ( pks ) == 1 and ( not exclude or pks [ 0 ] != exclude ) : self . connection . delete ( self . field . key ) raise UniquenessError ( 'Value "%s" already indexed for unique field %s.%s (for instance %s)' % ( self . normalize_value ( value ) , self . model . __name__ , self . field . name , pks [ 0 ] ) )
Check uniqueness of pks

        Parameters
        -----------
        pks: iterable
            The pks to check for uniqueness. If more than one different,
            it will raise. If only one and different than `exclude`, it will
            raise too.
        exclude: str
            The pk that we accept to be the only one in `pks`. For example
            the pk of the instance we want to check for uniqueness: we don't
            want to raise if the value is the one already set for this instance
        value: any
            Only to be displayed in the error message.

        Raises
        ------
        UniquenessError
            - If at least two different pks
            - If only one pk that is not the `exclude` one