[英]linking to the index.html to other html page in Django
我是 Django 項目的新手。 我一直在嘗試創建一種情況,當用戶按下導航欄中的“立即致電我們”按鈕時,它會將它們鏈接到其他 html 頁面(此處:contact.html)。 我該如何調整我必須實現的目標?
這是我的文件:index.html
code: </ul><a href="contact.html"><button class="btn btn-primary" type="button">call us now!</button></a></div>
視圖.py
from django.shortcuts import render
def index(request):
return render(request, 'jobs/index.html')
def contacts(request):
return render(request, 'jobs/contact.html')
在 urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('', jobs.views.index, name='index'),
path('contact/', jobs.views.contacts, name='contact'),] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)**
改變
href="contact.html"
至:
href="{% url 'contact' %}"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.