Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added accepted_response property on question model

  • Loading branch information...
commit a902383f1d55922d582db1ded47f1f1e1ccf402c 1 parent 874dbfa
@jtauber jtauber authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 aiteo/models.py
View
8 aiteo/models.py
@@ -31,6 +31,14 @@ def update_score(self):
self.vote_count = result["num_votes"]
self.save()
+ @property
+ def accepted_response(self):
+ try:
+ response = self.responses.get(accepted=True)
+ except Response.DoesNotExist:
+ response = None
+ return response
+
def get_absolute_url(self):
kwargs = {
"question_id": self.pk,

0 comments on commit a902383

Please sign in to comment.
Something went wrong with that request. Please try again.