처음으로 장고 앱을 개발하고 있습니다. 어떻게여러 모델을 템플릿에 전달하는 장고
views.py
from django.views.generic import ListView, DetailView
from django.utils import timezone
from LastAlly.models import Article, Episode
class IndexView(ListView):
queryset = Article.objects.all().order_by("-date")[:3]
template_name = 'index.html'
당신은보기의 방법을 편집 할 수 있습니다
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import ListView, DetailView
from LastAlly.views import IndexView
urlpatterns = [
url(r'^$', IndexView.as_view(),),
]
"여러 모델을 템플릿에 전달"이란 무엇을 의미합니까? – Gocht
인덱스 템플릿에 에피소드 모델을 사용해야합니다. – Crownstyle