I have a url mapping that looks like this:
url(r'^(?P<lang>[a-z][a-z])/$', MyTemplateView.as_view()),
There are only a few values that I accept for the lang
capture group, that is: (1) ro
and (2) en
. If the user types http://server/app/fr/
, I want to redirect it to the default http://server/app/en/
.
How can I do this since MyTemplateView
only has a method that is expected to return a dictionary?
def get_context_data(self, **kwargs):
return { 'foo': 'blah' }