Home > Software engineering >  NameError: name 'urlpatterns' is not defined using i18n_patterns
NameError: name 'urlpatterns' is not defined using i18n_patterns

Time:03-18

I have problems writing the urls for translation. According to this question I understand that it is because I have = so I need to put this = the bad thing is that I have to translate all my urls I can't leave any outside of i18n, what can I do to include all my urls there?

from . import views
from django.urls import path
from django.conf.urls.i18n import i18n_patterns

app_name='Clientes'


urlpatterns = i18n_patterns(
    path('',views.list_clientes,name='clientes_list'),
    path('add',views.create_clientes.as_view(),name='clientes_add'),
    path('edit/<int:pk>',views.edit_clientes.as_view(),name='clientes_edit'),
    path('<int:pk>/',views.detail_clientes.as_view(),name='clientes_detail'),
    path('delete/<int:pk>',views.eliminar_cliente.as_view(),name='clientes_delete'),
)

CodePudding user response:

You did not define urlpatterns before. If you want to translate all paths, you use:

#                      
  • Related