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))
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))
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)
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)
def get(self): entries = [e for e in Entry.select().order_by(Entry.date.desc())] self.render('clipboard.html', entries=entries)
def get(self): entries = [e.to_dict() for e in Entry.select().order_by(Entry.date.desc())] self.write(json.dumps(entries))
def entry_exists(entry): return Entry.select().where(Entry.url == entry.url).exists()