@any_field.register(models.FilePathField)
def any_filepath_field(field, **kwargs):
    def get_some_file(path):
        subdirs, files = [], []
        for entry in os.listdir(path):
            entry_path = os.path.join(path, entry)
            if os.path.isdir(entry_path):
                subdirs.append(entry_path)
            else:
                if not field.match or re.match(field.match,entry):
                    files.append(entry_path)

        if files:
            return random.choice(files)
        
        if field.recursive:
            for subdir in subdirs:
                result = get_some_file(subdir)
                if result:
                    return result

    result = get_some_file(field.path)
    if result is None and not field.null:
        raise TypeError("Can't found file in %s for non nullable FilePathField" % field.path)
    return result
Increment a column's value by a given amount
dataset/ETHPy150Open kmmbvnr/django-any/django_any/models.py/any_filepath_field--crossover with--dataset/ETHPy150Open sdispater/orator/orator/query/builder.py/QueryBuilder.increment