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