Consider a request coming from this url /messages/compose/(?P<recipients>[\+\.\w]+)/ where recipients is usernames separated by + sign. After success (message to recipients successfully sent) i am doing:
#success_url = 'message_send_success'
recipients = '+'.join([obj.username for obj in recipients]) #converting them back to original string
reverse(success_url, kwargs={'recipients': recipients})
This is the url to whom it match:
url(r'^/messages/success/(?P<recipients>[\+\.\w]+)$', 'site.views.message_send_success', name='message_send_success')
But it will show all recipients in the url, is there any away i can hide those recipients string to be displayed in url and can access it in request??
Not if you’re using a redirect. Django has a “shared-nothing” architecture, which means that between one request and the next no user state persists on the server. For this reason, Django can’t (automatically) “remember” what your recipients were before the redirect, so it can access them in the next HTTP request.
What are your reasons for wanting to hide them? Is there sensitive information you can’t send back to the client, or something like that? One option to avoid that is to simply repeat the information the client sent (i.e. the original
recipientsparameter) and have thesuccessview redo the operations thatcomposedid on them.