In my Django apps, I have many urls including /(?P<project_name>[_\w]+)/
.
The project_name
is defined by users and it is an attribute of the Project
model.
I've added a validator on the project_name
to check if it's lowercase.
So new names are all lowercase but some old names include uppercase characters.
I would like to change all the names stored to make them lowercase but at the same time, I don't want users to get an error when trying to access to one of the url with the old project name including uppercase characters.
As I have many urls and many views, I don't want to update each to manually .lower()
the project_name
.
Is there a way to redirect all urls including /<project_NAME>/
to /<project_name>/
?