summaryrefslogtreecommitdiff
path: root/website/models.py
diff options
context:
space:
mode:
authorJayaram Pai2014-03-19 13:22:23 +0530
committerJayaram Pai2014-03-19 13:22:23 +0530
commitdffa556eede4d633879e55b60bf95e4469c530c0 (patch)
tree4f20ef8a8291123adfef10101a727b4f1029b0e1 /website/models.py
parent45ee2992b4ec72c62d5ce69611589521e16d0366 (diff)
downloadspoken-tutorial-forums-dffa556eede4d633879e55b60bf95e4469c530c0.tar.gz
spoken-tutorial-forums-dffa556eede4d633879e55b60bf95e4469c530c0.tar.bz2
spoken-tutorial-forums-dffa556eede4d633879e55b60bf95e4469c530c0.zip
added commenting feature on the answers
replies are now renamed to answers
Diffstat (limited to 'website/models.py')
-rw-r--r--website/models.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/website/models.py b/website/models.py
index 52575b8..a995af7 100644
--- a/website/models.py
+++ b/website/models.py
@@ -15,24 +15,47 @@ class Question(models.Model):
body = models.TextField()
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)
- views = models.IntegerField()
+ views = models.IntegerField(default=1)
+ votes = models.IntegerField(default=0)
def user(self):
user = User.objects.get(id=self.uid)
return user.username
+class QuestionVote(models.Model):
+ uid = models.IntegerField()
+ question = models.ForeignKey(Question)
-class Reply(models.Model):
+class QuestionComment(models.Model):
+ uid = models.IntegerField()
+ question = models.ForeignKey(Question)
+ body = models.TextField()
+ date_created = models.DateTimeField(auto_now_add=True)
+ date_modified = models.DateTimeField(auto_now=True)
+
+class Answer(models.Model):
uid = models.IntegerField()
question = models.ForeignKey(Question)
body = models.TextField()
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)
+ votes = models.IntegerField(default=0)
def user(self):
user = User.objects.get(id=self.uid)
return user.username
+class AnswerVote(models.Model):
+ uid = models.IntegerField()
+ answer = models.ForeignKey(Answer)
+
+class AnswerComment(models.Model):
+ uid = models.IntegerField()
+ answer = models.ForeignKey(Answer)
+ body = models.TextField()
+ date_created = models.DateTimeField(auto_now_add=True)
+ date_modified = models.DateTimeField(auto_now=True)
+
class Notification(models.Model):
uid = models.IntegerField()
pid = models.IntegerField()
@@ -47,6 +70,7 @@ class TutorialDetails(models.Model):
tutorial_name = models.CharField(max_length=600L)
tutorial_level = models.CharField(max_length=400L)
order_code = models.IntegerField()
+
class Meta:
db_table = 'tutorial_details'
@@ -72,5 +96,6 @@ class TutorialResources(models.Model):
cvideo_version = models.IntegerField()
hit_count = models.BigIntegerField()
request_exception = models.TextField()
+
class Meta:
db_table = 'tutorial_resources'