<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def formfield_for_dbfield(self, db_field, **kwargs):
        ''' Offer only gradings that are not used by other schemes, which means they are used by this scheme or not at all.'''
        if db_field.name == "gradings":
            request=kwargs['request']
            try:
                #TODO:  MockRequst object from unit test does not contain path information, so an exception occurs during test.
                #       Find a test-suite compatible solution here.
                obj=resolve(request.path).args[0]
                filterexpr=Q(schemes=obj) | Q(schemes=None)
                kwargs['queryset'] = Grading.objects.filter(filterexpr).distinct()
            except:
                pass
        return super(GradingSchemeAdmin, self).formfield_for_dbfield(db_field, **kwargs)