def list_notes(request): """List all notes """ notes = Note.view('notes/all') return render("list_notes.html", { "notes": notes, })
def list_notes(request): """List all notes documents present on the couch DB. """ notes = Note.view('notes/heads') or None return render("list_notes.html", { "notes": notes, }, request)
def show_tag(request, tag_name): """Display a list of notes related to a special tag. """ notes = Note.view("notes/by_tag", startkey=tag_name, endkey=tag_name) return render("list_notes.html", { "tag_name": tag_name, "notes": notes, }, request)
def delete_note(request, note_id): """Delete a note and redirect to the list of notes. Here, we entierly delete the note and it's revisions. DO NOT USE TO JUST REMOVE A REVISION, IT WILL DESTROY ALL INFORMATION RELATED TO THIS NOTE. """ note = Note.get_note(note_id) notes = Note.view("notes/by_root", startkey=note.root, endkey=[note.root, []]) for note in notes: note.delete() return redirect('notes:list')
def list_tags(request): """List all tags, with a ponderation, into a tag cloud """ tags = Note.view("notes/tags", group=True) factor = float(max([int(t['value']) for t in tags])) / 10 tags = [{ 'key': t['key'], 'value': int(round(float(t['value'])/factor)) } for t in tags] return render("list_tags.html", { 'tags': tags, }, request)