Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
i18n_patterns 在我的项目中运行良好,但是,(r'^support/$', RedirectView.as_view(url='/helpdesk/tickets/')),在我的 urls.py 中重定向到默认语言而不是当前活动的语言。
(r'^support/$', RedirectView.as_view(url='/helpdesk/tickets/')),
我该如何克服这个问题?
使用动态 url using reverse,是一个静态 urlpattern,如果语言设置不是默认设置(在本例中为英语),/helpdesk/tickets/它可能会抛出一个。404
reverse
/helpdesk/tickets/
404
urlpatterns = i18n_patterns('', (_(r'^helpdesk/tickets/$', HelpdeskView.as_view(), name='tickets') (_(r'^support/$'), RedirectView.as_view(url=reverse_lazy('tickets')) )