예제 #1
0
파일: views.py 프로젝트: lambroisie/osf.io
def find_bookmark_collection(user):
    bookmark_collection = Node.find(
        Q('is_bookmark_collection', 'eq', True)
        & Q('contributors', 'eq', user._id))
    if bookmark_collection.count() == 0:
        new_bookmark_collection(user)
    return bookmark_collection[0]
예제 #2
0
def migrate():
    targets = get_targets()
    total = len(targets)
    for i, user in enumerate(targets):
        logger.info('({}/{}) Preparing to migrate User {}'.format(i + 1, total, user._id))
        bookmark = new_bookmark_collection(user)
        bookmark.save()
        logger.info('Successfully migrated User {}'.format(user._id))
    logger.info('Successfully migrated {} users'.format(total))
예제 #3
0
파일: views.py 프로젝트: fredtoh/osf.io
def find_bookmark_collection(user):
    bookmark_collection = Node.find(Q('is_bookmark_collection', 'eq', True) & Q('contributors', 'eq', user._id))
    if bookmark_collection.count() == 0:
        new_bookmark_collection(user)
    return bookmark_collection[0]
예제 #4
0
파일: views.py 프로젝트: ycchen1989/osf.io
def find_bookmark_collection(user):
    bookmark_collection = Node.find(Q("is_bookmark_collection", "eq", True) & Q("contributors", "eq", user._id))
    if bookmark_collection.count() == 0:
        new_bookmark_collection(user)
    return bookmark_collection[0]