python - How to show the content of each Evernote note in Django -


https://github.com/evernote/evernote-sdk-python/blob/master/sample/django/evernote_oauth_sample/templates/oauth/callback.html

https://github.com/evernote/evernote-sdk-python/blob/master/sample/django/oauth/views.py

show content of 1st note (works):

// views.py (my fork)

updated_filter = notefilter(order=notesortorder.updated) updated_filter.notebookguid = notebooks[0].guid offset = 0 max_notes = 1000 result_spec = notesmetadataresultspec(includetitle=true) result_list = note_store.findnotesmetadata(auth_token, updated_filter, offset, max_notes, result_spec)  note_guid = result_list.notes[0].guid content = note_store.getnotecontent(auth_token, note_store.getnote(note_guid, true, false, false, false).guid) return render_to_response('oauth/callback.html', {'notebooks': notebooks, 'result_list': result_list, 'content': content}) 

// oauth/callback.html (my fork)

<ul>   {% note in result_list.notes %}     <li><b>{{ note.title }}</b><br>{{ content }}</li>   {% endfor %} 

how show content of each note in django ? (this 1 of unsuccessful attempts)

updated_filter = notefilter(order=notesortorder.updated)     updated_filter.notebookguid = notebooks[0].guid     offset = 0     max_notes = 1000     result_spec = notesmetadataresultspec(includetitle=true)     result_list = note_store.findnotesmetadata(auth_token, updated_filter, offset, max_notes, result_spec)      contents = []     note in result_list.notes:         content = note_store.getnotecontent(auth_token, note_store.getnote(note.guid, true, false, false, false).guid)         contents.append(content)  return render_to_response('oauth/callback.html', {'notebooks': notebooks, 'result_list': result_list, 'contents': contents}) 

<ul>   {% note in result_list.notes %}       {% content in contents %}         <li><b>{{ note.title }}</b><br>{{ content }}</li>   {% endfor %} </ul> 

you should associate content each note using data structure(assume no note.title same):

title_contents = {} note in result_list.notes:     content = note_store.getnotecontent(auth_token,                                          note_store.getnote(note.guid,                                          true,false, false, false).guid)     title_contents[note.title] = content  return render_to_response('oauth/callback.html', {'notebooks': notebooks,                                                    'result_list': result_list,                                                    'title_contents': title_contents}) 

in template:

<ul>   {% title, content in title_contents.items %}     <li><b>{{ title }}</b><br>{{ content }}</li>   {% endfor %} </ul> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -