Re: django1.5 - url resolver vs i18n_patterns : wrong behaviour
For those who also suffers: yes its a bug. https://code.djangoproject.com/ticket/17734 it was fixed in 1.6b2 вторник, 4 июня 2013 г., 13:23:23 UTC+4 пользователь Ivan Tatarchuk написал: > > When I using i18n_patterns in my project urls.py I have strange behaviour > of url resolver: > expected behaviour: > - if pattern defined in django.conf.urls.patterns, url resolver > doesn't add language prefix > - ip pattern defined in django.conf.urls.i18n.i18n_patterns, url > resolver adds language prefix at the begining of url > > actual behaviour > if NO patterns defined in i18n_patterns, all work fine > but if some pattern defined in i18n_patterns, url resolver add > language prefix to ALL urls resoved by url resolver regardless of place of > pattern defenition (django.conf.urls.patterns or > django.conf.urls.i18n.i18n_patterns) > > Example: > > * urls.py * > from django.conf.urls import patterns, include, url > from django.conf.urls.i18n import i18n_patterns > > urlpatterns = patterns('', > url(r'^admin/', include(admin.site.urls)), > ) > > urlpatterns += i18n_patterns('', > # url(r'^other/', include('apps.other.urls')), > } > > now {% url 'admin:password_change' %} resolved as 'admin/password_change' > (normal behaviour) > but if we uncomment line in i18n_patterns it will be resolved as > 'curr_lang/admin/password_change' > > Can somebody explaine my why? > Thanks > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: django1.5 - url resolver vs i18n_patterns : wrong behaviour
On Thu, Jun 6, 2013 at 3:24 PM, Ivan Tatarchukwrote: > Not shure if I understand you correctly, but if I use static linking all > works fine. > Problem appears only with dynamic linking(like in admin templates). > Is this a feature or a kind of bug? > really want to use django's i18n_patterns in my project, but can’t > understand how to escape from this case. ='( Sorry for the delayed follow-up. I've just tested he scenario you describe on trunk (1.7dev), 1.6beta1 and 1.5.1 and I couldn't reproduce the issue. The admin app is always published at /admin/ and the URLs of the 'apps.other' app with an 'apps.other.urls' included urlconf plus views are always prefixed by the language code (e.g. /en/other/hello/ or /es-ar/other/hello/) There seems to be something else at play in your setup that is causing the problem. -- Ramiro Morales @ramiromorales -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: django1.5 - url resolver vs i18n_patterns : wrong behaviour
Not shure if I understand you correctly, but if I use static linking all works fine. Problem appears only with dynamic linking(like in admin templates). Is this a feature or a kind of bug? really want to use django's i18n_patterns in my project, but can't understand how to escape from this case. ='( вторник, 4 июня 2013 г., 17:38:05 UTC+3 пользователь Ramiro Morales написал: > > On Tue, Jun 4, 2013 at 6:23 AM, Ivan Tatarchuk >wrote: > > > from django.conf.urls import patterns, include, url > > from django.conf.urls.i18n import i18n_patterns > > > > urlpatterns = patterns('', > > url(r'^admin/', include(admin.site.urls)), > > ) > > > > urlpatterns += i18n_patterns('', > > # url(r'^other/', include('apps.other.urls')), > > } > > > > now {% url 'admin:password_change' %} resolved as > 'admin/password_change' > > (normal behaviour) > > but if we uncomment line in i18n_patterns it will be resolved as > > 'curr_lang/admin/password_change' > > > > Can somebody explaine my why? > > Can you try to isolate reduce and isolate your environment to something > similar > to a test case so we can find the reason of that behavior? > > I've just added a test to our test suite exercising (correct behavior > in) a similar scenario: > > > https://github.com/django/django/blob/master/tests/i18n/patterns/urls/default.py#L9 > > > https://github.com/django/django/blob/master/tests/i18n/patterns/urls/included.py > > > https://github.com/django/django/blob/master/tests/i18n/patterns/tests.py#L52 > > The only difference is that in your case you are including the admin > dynamic, > namespaced url map so laying with some variation there would be a good way > to > get further. > > Regards, > > -- > Ramiro Morales > @ramiromorales > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: django1.5 - url resolver vs i18n_patterns : wrong behaviour
On Tue, Jun 4, 2013 at 6:23 AM, Ivan Tatarchukwrote: > from django.conf.urls import patterns, include, url > from django.conf.urls.i18n import i18n_patterns > > urlpatterns = patterns('', > url(r'^admin/', include(admin.site.urls)), > ) > > urlpatterns += i18n_patterns('', > # url(r'^other/', include('apps.other.urls')), > } > > now {% url 'admin:password_change' %} resolved as 'admin/password_change' > (normal behaviour) > but if we uncomment line in i18n_patterns it will be resolved as > 'curr_lang/admin/password_change' > > Can somebody explaine my why? Can you try to isolate reduce and isolate your environment to something similar to a test case so we can find the reason of that behavior? I've just added a test to our test suite exercising (correct behavior in) a similar scenario: https://github.com/django/django/blob/master/tests/i18n/patterns/urls/default.py#L9 https://github.com/django/django/blob/master/tests/i18n/patterns/urls/included.py https://github.com/django/django/blob/master/tests/i18n/patterns/tests.py#L52 The only difference is that in your case you are including the admin dynamic, namespaced url map so laying with some variation there would be a good way to get further. Regards, -- Ramiro Morales @ramiromorales -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
django1.5 - url resolver vs i18n_patterns : wrong behaviour
When I using i18n_patterns in my project urls.py I have strange behaviour of url resolver: expected behaviour: - if pattern defined in django.conf.urls.patterns, url resolver doesn't add language prefix - ip pattern defined in django.conf.urls.i18n.i18n_patterns, url resolver adds language prefix at the begining of url actual behaviour if NO patterns defined in i18n_patterns, all work fine but if some pattern defined in i18n_patterns, url resolver add language prefix to ALL urls resoved by url resolver regardless of place of pattern defenition (django.conf.urls.patterns or django.conf.urls.i18n.i18n_patterns) Example: * urls.py * from django.conf.urls import patterns, include, url from django.conf.urls.i18n import i18n_patterns urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), ) urlpatterns += i18n_patterns('', # url(r'^other/', include('apps.other.urls')), } now {% url 'admin:password_change' %} resolved as 'admin/password_change' (normal behaviour) but if we uncomment line in i18n_patterns it will be resolved as 'curr_lang/admin/password_change' Can somebody explaine my why? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.