Fix a bug with tweets
authorCharles Connell <charles@connells.org>
Sat, 10 May 2014 23:11:51 +0000 (19:11 -0400)
committerCharles Connell <charles@connells.org>
Sat, 10 May 2014 23:11:51 +0000 (19:11 -0400)
karmaworld/apps/notes/tasks.py

index fe5534b1bdbb5f621a7fe53f4d76510171907ce2..946ebaa0aedd48540b2e3438cd15c41393be9ce2 100644 (file)
@@ -58,8 +58,13 @@ def tweet_string(note):
     # 57 characters
     short_note = note.name[:57]
 
-    if note.course.school.hashtag:
-        return short_url + " #" + note.course.school.hashtag + " " + \
+    if note.course.school:
+        school = note.course.school
+    else:
+        school = note.course.department.school
+
+    if school.hashtag:
+        return short_url + " #" + school.hashtag + " " + \
         short_course + ": " + \
         short_note
     else: