- edited description
Add namespace support for named Urls.
It would be nice to have postman support Django namespaces for Urls. This would allow multiple apps within a project to use one postman instance with different url options (e.g. user_filter based on current user role). Afaik there are only the reverse() calls in views.py that need patching, e.g. {{{ def _folder(...): ... app_name = resolve(request.path).app_name namespace = resolve(request.path).namespace return render_to_response(template_name, { 'pm_messages': msgs, # avoid 'messages', already used by contrib.messages 'by_conversation': option is None, 'by_message': option == OPTION_MESSAGES, 'by_conversation_url': reverse('%s:%s' % (namespace, view_name), current_app=app_name), 'by_message_url': reverse('%s:%s' % (namespace, view_name), args=[OPTION_MESSAGES], current_app=app_name), 'current_url': request.get_full_path(), 'gets': request.GET, # useful to postman_order_by template tag }, context_instance=RequestContext(request)) }}} I can create a pull request if this of any interest to you.
Let me know if this makes any sense (I am a complete newbie to Django/Python so it is likely that I am missing something ;))
Mischa
Comments (5)
-
reporter -
reporter - edited description
-
reporter - edited description
-
repo owner - changed status to open
-
repo owner - changed status to resolved
Implemented. Now the namespace is mandatory.
The application namespace (
app_name
) has to be 'postman', but the instance namespace (namespace
) choice is free.(r'^messages/', include('postman.urls', namespace='postman', app_name='postman')),
- Log in to comment