python - How to set up django-siteree with django-postman -
i'm trying set django-sitetree work django-postman, i'm not having luck.
most of pages work correctly, can't seem figure out how map postman_view url work properly. here's have far. maybe can me out bit?
sitetrees.py
from sitetree.utils import tree, item sitetrees = ( tree('postman', items=[ item('messages', '/messages/', url_as_pattern=false, access_guest=false, access_loggedin=true, children=[ item('compose', 'postman_write', access_guest=false, access_loggedin=true), item('inbox', 'postman_inbox', access_guest=false, access_loggedin=true), item('view', 'postman_view message.id', access_guest=false, access_loggedin=true, in_menu=false, in_sitetree=false) ]) ]) )
postman urls.py excerpt
urlpatterns = patterns('', url(r'^inbox/(?:(?p<option>'+options+')/)?$', inboxview.as_view(), name='postman_inbox'), url(r'^sent/(?:(?p<option>'+options+')/)?$', sentview.as_view(), name='postman_sent'), url(r'^archives/(?:(?p<option>'+options+')/)?$', archivesview.as_view(), name='postman_archives'), url(r'^trash/(?:(?p<option>'+options+')/)?$', trashview.as_view(), name='postman_trash'), url(r'^write/(?:(?p<recipients>[^/#]+)/)?$', writeview.as_view(), name='postman_write'), url(r'^reply/(?p<message_id>[\d]+)/$', replyview.as_view(), name='postman_reply'), url(r'^view/(?p<message_id>[\d]+)/$', messageview.as_view(), name='postman_view'), url(r'^view/t/(?p<thread_id>[\d]+)/$', conversationview.as_view(), name='postman_view_conversation'), url(r'^archive/$', archiveview.as_view(), name='postman_archive'), url(r'^delete/$', deleteview.as_view(), name='postman_delete'), url(r'^undelete/$', undeleteview.as_view(), name='postman_undelete'), (r'^$', redirectview.as_view(url='inbox/')), )
both postman_write
, postman_inbox
work fine, when visit postman_view
error:
sitetreeerror @ /messages/view/2/ unable resolve current sitetree item `title_resolved` current page. check whether there appropriate sitetree item defined current url.
thanks idle sign pointing me in right direction.
turns out postman/view.html template not have variable called message, had assumed. there array of messages called pm_messages
. corrected sitetrees.py is:
sitetrees = ( tree('postman', items=[ item('messages', '/messages/', url_as_pattern=false, access_guest=false, access_loggedin=true, children=[ item('compose', 'postman_write', access_guest=false, access_loggedin=true), item('inbox', 'postman_inbox', access_guest=false, access_loggedin=true), item('view', 'postman_view pm_messages.0.id', access_guest=false, access_loggedin=true, in_menu=false, in_sitetree=false) ]) ]) )
Comments
Post a Comment