首页 > 解决方案 > URLField 附加到 'http://127.0.0.1:8000/'

问题描述

我有一个ULRField我正在尝试使用的链接,href但是当我点击它时,我会选择类似的东西http://127.0.0.1:8000/www.example.com而不是www.example.com

模型.py

class Website(models.Model):
    website = models.URLField(max_length=100)

模板.html

<a href="{{ dealer.website }}">{{ dealer.website }}</p>

标签: djangodjango-modelsdjango-templates

解决方案


将我的评论移至答案:

使用协议保存值https://


推荐阅读