1 2 3 4 5 6 7 8 9 10 11 12 13
| from django.shortcuts import render from .models import Topic
def index(request): """学习笔记的主页""" return render(request, 'learning_logs/index.html')
def topics(request): """显示所有的主题""" topics = Topic.objects.order_by('data_added') context = {'topics': topics} return render(request, 'learning_logs/topics.html', context)
|