Ejemplo n.º 1
0
def list_notes(request):
    """List all notes
    
    """
    notes = Note.view('notes/all')
    return render("list_notes.html", {
        "notes": notes,
    })
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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')
Ejemplo n.º 5
0
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)