def get_scholarships():
"""
Retrieves a sorted list of all scholarships available.
:return: the list of scholarships
:rtype: list
"""
cursor = connection.cursor()
cursor.execute("""
SELECT DISTINCT(name)
FROM %s
WHERE char_length(name) > 0
ORDER BY name ASC
""" % Scholarship._meta.db_table)
result = []
for row in cursor.fetchall():
result.append(row[0])
return result
评论列表
文章目录