python - Django URL Case issue -


i'm using following regex build urls follows:

...templates/file

url(r'^(?p<slug>[\w-]+)/$', views.template_type, name="template"), url(r'^(?p<template>[\w-]+)/(?p<slug>[\w-]+)/$', views.template_file, name="file"), 

the first line in here works fine pulling slug field template model. it's second line have problem. in second line

  • the slug pulled file model field
  • template pulled foreign key field in file model of template model

although working fine. foreign key pulls title rather slug template model making url case insensitive.

eg
website.com/template - works fine goes website.com/template/file works, if user deleted file url try go website.com/template 404 error.

i hope makes sense. i've tried making urls case insensitive (?i) has not worked.

thanks


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -