More unit testing
This commit is contained in:
parent
5ab0b8c837
commit
ff050cc141
4 changed files with 36 additions and 9 deletions
|
|
@ -58,6 +58,16 @@ class Question(models.Model):
|
|||
"""
|
||||
return self.answers.filter(correct=True)
|
||||
|
||||
def check_answer(self, answerid):
|
||||
"""
|
||||
Check if answerid is correct. Returns True if correct, else False
|
||||
"""
|
||||
for answer in self.correct_answers():
|
||||
if answer.id == int(answerid):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def __unicode__(self):
|
||||
return self.text
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue