(self, fieldname, value, instance=None, exception=None)
return qs.backend_query().items(callback=callback)
Test if a given field *fieldname* has a unique *value*
in :attr:`model`. The field must be an index of the model.
If the field value is not unique and the *instance* is not the same
an exception is raised.

:parameter fieldname: :class:`Field` name to test
:parameter vale: :class:`Field` value
:parameter instance: optional instance of :attr:`model`
:parameter exception: optional exception class to raise if the test fails.
    Default: :attr:`ModelMixin.DoesNotValidate`.
:return: *value*
Test if a given field *fieldname* has a unique *value*
in :attr:`model`. The field must be an index of the model.
If the field value is not unique and the *instance* is not the same
an exception is raised.
Test if a given field * fieldname * has a unique * value * in : attr : model . The field must be an index of the model . If the field value is not unique and the * instance * is not the same an exception is raised .
def test_unique(self, fieldname, value, instance=None, exception=None):
        '''Test if a given field *fieldname* has a unique *value*
in :attr:`model`. The field must be an index of the model.
If the field value is not unique and the *instance* is not the same
an exception is raised.

:parameter fieldname: :class:`Field` name to test
:parameter vale: :class:`Field` value
:parameter instance: optional instance of :attr:`model`
:parameter exception: optional exception class to raise if the test fails.
    Default: :attr:`ModelMixin.DoesNotValidate`.
:return: *value*
'''
        qs = self.filter(**{fieldname: value})
        callback = partial(self._test_unique, fieldname, value,
                           instance, exception)
        return qs.backend_query().items(callback=callback)
def test_unique ( self , fieldname , value , instance = None , exception = None ) : qs = self . filter ( * * { fieldname : value } ) callback = partial ( self . _test_unique , fieldname , value , instance , exception ) return qs . backend_query ( ) . items ( callback = callback )