Files
2012-02-21 01:15:00 -05:00

1 line
4.7 KiB
JSON

[{"user_id": 13002, "stars": [], "topic_id": 9508, "date_created": 1298899357.4773669, "message": "1. middleware that looks first at {{lan}} and then {{site}} on the path. then pass those \"in\" via your process_request function. in the view, send in the request context.", "group_id": 81, "id": 225335}, {"user_id": 13002, "stars": [], "topic_id": 9508, "date_created": 1298899362.1963489, "message": "2. cut the path up in your view.", "group_id": 81, "id": 225337}, {"user_id": 10074, "stars": [], "topic_id": 9508, "date_created": 1298899588.0749791, "message": "can I access the context I'm coming from?", "group_id": 81, "id": 225391}, {"user_id": 10074, "stars": [], "topic_id": 9508, "date_created": 1298898217.528677, "message": "Hey guys,\nMy URLs look like this /{{lan}}/some/sites. So I always pass the actual language to new sites with my lan variable. Now I want to be able to change the language. I just need change lan to other characters. But how can I do this, I don't want to refer to the main site. I want to stay on the current url path, and I just want to change the {{lan}}. How can I do this? I think it's the same problem with a login. How can I refer back to the URL I'm coming in my views? Thank You :)", "group_id": 81, "id": 225205}, {"user_id": 13002, "stars": [], "topic_id": 9508, "date_created": 1298899350.057086, "message": "2 ways maybe.", "group_id": 81, "id": 225332}, {"user_id": 10074, "stars": [], "topic_id": 9508, "date_created": 1298900120.590297, "message": "sry. It's not easy for me to descripe my answer properly in english :D\nI have a \"login\" and a \"change language\" view. Both of them shall refer to the site I'm coming from. \"login\" logins the user and should refer to the site the user viewed before. Also the \"language\" view should only change the URL and refer to the same URL back, where the user clicked the Flag (/en/pens -> /de/pens)", "group_id": 81, "id": 225490}, {"user_id": 10074, "stars": [], "topic_id": 9508, "date_created": 1298899629.490294, "message": "or can I get the URL I'm coming from?\nsomething like request.url", "group_id": 81, "id": 225395}, {"user_id": 10074, "stars": [], "topic_id": 9508, "date_created": 1298901601.1436629, "message": "yes I also pass the lan variable to the new URL. But how can I refer back to the url I'm coming.\nview:\ndef login(request,lan='en'):\n[...]\nreturn render_to_response('template.html',{'lan': lan}, ...)\nurl:\n(r'^(?P<lan>[a-z].*)/auth/login/$', 'psdb.views.login'),\n\nWhen I'm at /en/some/sites and I submit the form to the url \"/{{lan}}/auth/login\" I want to redirect me to \"/en/some/sites\" when I'm finished. And not to the \"template.html\".", "group_id": 81, "id": 225692}, {"user_id": 13002, "stars": [], "topic_id": 9508, "date_created": 1298899882.0369699, "message": "i'm not clear on what you're trying to do but yes if the request context doesn't provide what you need, middleware + your own context_processor will work.", "group_id": 81, "id": 225462}, {"user_id": 13002, "stars": [], "topic_id": 9508, "date_created": 1298901289.3880129, "message": "the way i handle this is in context_processor. pass in the form lang var into request. hand back the url for the new lang.", "group_id": 81, "id": 225652}, {"user_id": 13002, "stars": [], "topic_id": 9508, "date_created": 1298901449.7305601, "message": "true. i would go with \"plethora\" for ways.", "group_id": 81, "id": 225679}, {"user_id": 10074, "stars": [], "topic_id": 9508, "date_created": 1298901708.459934, "message": "Thanks for the JS Tipp.. I didn't consider that xD\nThanks...\nI could do the same with an hidden form field url with the current url, but that seems a bit unproper... But if I can't do it in the view how I want, I do it with the url hidden field.", "group_id": 81, "id": 225712}, {"user_id": 16446, "stars": [], "topic_id": 9508, "date_created": 1298902027.7070539, "message": "or also use a context_processor/middleware that adds some extra context variables using the reverse url function to render multiple versions (one for each language)", "group_id": 81, "id": 225757}, {"user_id": 16446, "stars": [], "topic_id": 9508, "date_created": 1298901410.628417, "message": "you can also use a simple javascript to do that, split the current url and change the lang to any other", "group_id": 81, "id": 225671}, {"user_id": 214, "stars": [{"date_created": 1298917705.975369, "user_id": 1}, {"date_created": 1298967948.866184, "user_id": 14305}, {"date_created": 1298983507.088779, "user_id": 927}], "topic_id": 9508, "date_created": 1298910014.030066, "message": "You may want to look at http://packages.python.org/django-localeurl/ - this is precisely what it does, if I'm understanding what you're trying to do correctly.", "group_id": 81, "id": 226797}]