def get_papers(paper):
"""
Retrieves a sorted list of all the papers that match the search (eg COMP900 or PSYC9%).
:param paper: the paper search string
:type paper: str
:return: the list of papers
:rtype: list
"""
sql = """
select distinct(paper_master_code)
from %s
where paper_master_code like '%s'
order by paper_master_code
""" % (GradeResults._meta.db_table, paper)
cursor = connection.cursor()
cursor.execute(sql)
result = []
for row in cursor.fetchall():
result.append(row[0])
return result
评论列表
文章目录