Esempio n. 1
0
def get_unread_entries(count, offset, priority, order):
    if count == 0:
        return []
    order = getattr(Entry.created_date, order)()
    return list(Entry.select().join(Feed).where(
        Feed.priority >= priority,
        Entry.is_read == False).order_by(order).offset(offset).limit(count))
Esempio n. 2
0
def get_unread_entries(count, offset, priority, order):
    if count == 0:
        return []
    order = getattr(Entry.created_date, order)()
    return list(Entry.select().join(Feed).where(
        Feed.priority >= priority,
        Entry.is_read == False
    ).order_by(order).offset(offset).limit(count))
Esempio n. 3
0
def get_all_entries():
    entries = []
    for entry in Entry.select():
        result = {
            'id': entry.id,
            'title': entry.title,
            'text': entry.text,
            'created_at': entry.created_at,
            'updated_at': entry.updated_at
        }
        entries.append(result)
    return json.dumps(entries)
Esempio n. 4
0
def search_entries(request):
    title = request.args.get('title')
    query = Entry.select().where(Entry.title.contains(title))

    entries = []
    for entry in query:
        result = {
            'id': entry.id,
            'title': entry.title,
            'text': entry.text,
            'created_at': entry.created_at,
            'updated_at': entry.updated_at
        }
        entries.append(result)
    return json.dumps(entries)
Esempio n. 5
0
 def get(self):
     entries = [e for e in Entry.select().order_by(Entry.date.desc())]
     self.render('clipboard.html', entries=entries)
Esempio n. 6
0
 def get(self):
     entries = [e.to_dict() for e in Entry.select().order_by(Entry.date.desc())]
     self.write(json.dumps(entries))
Esempio n. 7
0
def entry_exists(entry):
    return Entry.select().where(Entry.url == entry.url).exists()
Esempio n. 8
0
def entry_exists(entry):
    return Entry.select().where(Entry.url == entry.url).exists()