I made a mistake while writing my Django application in hard coding all the URLs in my templates.
For instance, my links look like:
<a href="/course/63/">Advanced Basketweaving</a>
Now, my client adamantly wants me to change all instances of links akin to this one to
<a href="/class/63/">Advanced Basketweaving</a>
where “class” replaces “course”.
In the words of Emerson, a foolish consistency is the hobgoblin of little minds, so I must pay for my mistake by undertaking a painstaking find and replace operation.
What was the right thing to do here?
Assuming your urls.py had an entry like this:
You could have used the url template tag in your template:
Then when your client asked you to change the urls, you would have to make only one change in your urls.py.
No change would be required in the templates.
Happy search and replacing — now you know for next time 😉