Is it ok to hardcode dynamic links in a permanent view?
-
27-09-2019 - |
Question
Let's say I wanted to showcase 2-3 clickable buttons on my homepage which will be there permanently. These are links to the css
, html
, and javascript
tag listing pages.
Is it fine to just hardcode href=/tags/css
and href=/tags/html
right in my django templates/view?
I won't change them for at least a year or so, meaning I don't think I need to add a column to the tags table to distinguish them - is this common or should I try to make it somewhat dynamic? These tags are in a table but so are 1000 other tags.
Solution
Just remember to document that you did it in some place obvious, like in tagging/views.py, or maybe you have an equivalent of my When_Peter_Gets_Hit_By_A_Bus.txt, in which I document all of these types of optimizations. No, I really do have a file like that for each of my customers.