'Validate that unique fields are unique.  Django manipulators do
this too, but they\'re a huge pain to use manually.  Trust me.'

def _validate_unique(self):

    errors = {}
    cls = type(self)
    field_dict = self.get_field_dict()
    manager = cls.get_valid_manager()
    for (field_name, field_obj) in field_dict.iteritems():
        if (not field_obj.unique):
            continue
        value = getattr(self, field_name)
        if ((value is None) and field_obj.auto_created):
            continue
        existing_objs = manager.filter(**{field_name: value})
        num_existing = existing_objs.count()
        if (num_existing == 0):
            continue
        if ((num_existing == 1) and (existing_objs[0].id == self.id)):
            continue
        errors[field_name] = ('This    value    must    be    unique    (%s)' % value)
    return errors
