Estoy intentando habilitar URL sluggified en Django de la forma que SO usa: example.com/id/slug. No tengo problemas para habilitar babosas, y tengo las URL configuradas actualmente del formulario: http://127.0.0.1:8000/articles/id/ (por ejemplo,/articles/1 /) y eso funciona bien. El patrón URL correspondiente es:Habilite URL sluggified en Django
(r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict),
Si cambio el patrón de URL a:
(r'^(?P<slug>\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict),
Entonces Recibo el siguiente EROR cuando navego a http://127.0.0.1:8000/articles/another-article/:
The current URL, articles/another-article/, didn't match any of these.
Si, sin embargo, Intento:
http://127.0.0.1:8000/articles/1/
me sale el error:
No article found matching the query
En última instancia quiero ser capaz de navegar a una Aricle a través de cualquiera de los dos:
http://127.0.0.1:8000/articles/1/ or http://127.0.0.1:8000/articles/1/another-article/
Sí, faltaba la coincidencia del patrón de expresión regular para la babosa real. –