PacktPublishing / Django-4-by-example

Django 4 by example (4th Edition) published by Packt
https://djangobyexample.com/
MIT License
818 stars 461 forks source link

Argument error in Courses/course/detail.html template error #57

Open awesomeAsfand opened 12 months ago

awesomeAsfand commented 12 months ago

It seems that subject might be None in some cases, causing the error "Reverse for 'course_listsubject' with arguments '('',)' not found. 1 pattern(s) tried: ['course/subject/(?P[-a-zA-Z0-9]+)/\Z']" when trying to reverse the URL. Suggested improvement in this case is by checking if subject is not None before attempting to access its attributes.