可以在永久视图中对动态链接进行硬编码吗?

发布于 2024-09-05 15:38:24 字数 315 浏览 1 评论 0原文

假设我想在我的主页上展示 2-3 个可点击的按钮,这些按钮将永久存在。这些是指向 csshtmljavascript 标记列表页面的链接。

在我的 django 模板/视图中直接硬编码 href=/tags/csshref=/tags/html 可以吗?

我至少在一年左右的时间内不会更改它们,这意味着我认为我不需要在标签表中添加一列来区分它们 - 这是常见的还是我应该尝试使其变得动态?这些标签位于表中,但其他 1000 个标签也在表中。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十年不长 2024-09-12 15:38:24

只需记住记录您在某个明显的地方执行了此操作,例如在 tagging/views.py 中,或者您可能有一个与我的 When_Peter_Gets_Hit_By_A_Bus.txt 等效的文件,其中我记录了所有这些类型的 < em>优化。不,我确实确实为每个客户都有一个这样的文件。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文