Beispiel #1
0
def test():
    username = "******"
    user = User.select().where(User.username == username).get()
    publications = Publication.select().where(
        Publication.user_created == user.id)
    for publi in publications:
        print(publi)
Beispiel #2
0
def publication(username=None):
    if username:  #si on lui passe un username en param
        user = User.select().where(
            User.username == username).get()  #on sélectionne le user
        publications = Publication.select(
        ).where(Publication.user_created == user.id).order_by(
            Publication.created_date.desc())  #on prend la liste de ses publi
    else:  # si on lui passe pas de username
        publications = Publication.select().order_by(
            Publication.created_date.desc(
            ))  #on prend la liste de toutes les publi
    if publications.count() == 0:
        flash("Aucune publication trouvée")
    return object_list('publications/list.html',
                       publications,
                       paginate_by=3,
                       check_bounds=False)
def get_citation_count_for_queries(queries, api_key):

    # Create a new fetch index.
    last_fetch_index = Publication.select(
        fn.Max(Publication.fetch_index)).scalar() or 0
    fetch_index = last_fetch_index + 1

    for query in queries:

        # Fetch the citation count!
        get_citation_count(query, fetch_index, api_key)
def main(*args, **kwargs):

    for publication in Publication.select():
        yield [[
            publication.year,
            publication.title,
            publication.citation_count,
            publication.author,
        ]]

    raise StopIteration
Beispiel #5
0
def main(*args, **kwargs):

    for publication in Publication.select():
        yield [[
            publication.year,
            publication.title,
            publication.citation_count,
            publication.author,
        ]]

    raise StopIteration
Beispiel #6
0
def testdb():
    for user in User.select():
        for publi in Publication.select():
            if publi.user_created == user:
                print(publi.user_created.id)