@library.global_function
def latest_announcement():
 if Announcement.objects.published().count():
  return Announcement.objects.published().latest()
 return None

@ library . global_function def latest_announcement ( ) : if Announcement . objects . published ( ) . count ( ) : return Announcement . objects . published ( ) . latest ( ) return None
return the latest published announcement or none .