报错问题描述: Reverse for 'home' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: ['org/home/(?P<org_id>\\d+)/$']
urlpatterns = [ # 机构首页 url(r'^list/$', OrgView.as_view(), name="org_list"), url(r'^add_ask/$', AddUserAskView.as_view(), name="add_ask"), url(r'^home/(?P<org_id>\d+)/$', OrgHomeView.as_view(), name="home"), ] .... #课程机构地址配置 url(r'^org/', include('organization.urls', namespace="org")), ... class OrgHomeView(View): def get(self, request, org_id): course_org = CourseOrg.objects.get(id=int(org_id)) all_courses = course_org.course_set.all()[:3] all_teachers = course_org.teacher_set.all()[:1] return render(request, 'org-detail-homepage.html', { 'all_courses': all_courses, 'all_teachers': all_teachers })
<div class="brief group_list"> {% for course in all_courses %} <div class="module1_5 box"> <a href="course-detail.html"><img width="214" src="{{ MEDIA_URL }}{{ course.image }}"/></a> <div class="des"> <a href="course-detail.html"><h2>{{ course.name }}</h2></a> <span class="fl">课时:<i class="key">{{ course.learn_time }}</i></span> <span class="fr">参加人数:{{ course.students }}</span> </div> <div class="bottom"> <span class="fl">{{ course.course_org.name }}</span> <span class="star fr notlogin " data-favid="13" data-fav-type="4"> {{ course.favorite_student }} </span> </div> </div> {% endfor %}
希望大家能够帮助解答。谢谢
XO鸡丝
KIWI2018
相关分类