for course in self.object_list:
if course.school:
schools.add(course.school)
- elif course.department.school:
+ elif course.department and course.department.school:
schools.add(course.department.school)
context['schools'] = sorted(list(schools), key=lambda x: x.name)
<li class="hide-for-large-up"><a href="{% url 'account_logout' %}">Log Out</a></li>
{% else %}
<li><a href="{% url 'account_signup' %}">Sign Up</a></li>
+ <li class="hide-for-large-up"><a href="{% url 'account_login' %}">Log In</a></li>
{% endif %}
</ul>
</section>