2017-08-26 11:40:35 -04:00
|
|
|
from django.db import models
|
|
|
|
from django.contrib.auth.models import User
|
|
|
|
|
2018-01-06 12:11:27 -05:00
|
|
|
from tinymce.models import HTMLField
|
|
|
|
|
2017-08-26 11:40:35 -04:00
|
|
|
|
|
|
|
class Thread(models.Model):
|
|
|
|
topic = models.CharField(max_length=255)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.topic
|
|
|
|
|
|
|
|
|
|
|
|
class Post(models.Model):
|
|
|
|
creator = models.ForeignKey(User)
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
2018-01-06 12:11:27 -05:00
|
|
|
resolved = models.BooleanField(default=False)
|
|
|
|
topic = models.ForeignKey(Thread)
|
|
|
|
title = models.CharField(max_length=255)
|
|
|
|
question = HTMLField()
|
2017-08-26 11:40:35 -04:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.title
|
|
|
|
|
|
|
|
|
|
|
|
class Comment(models.Model):
|
|
|
|
post = models.ForeignKey(Post)
|
2018-01-06 12:11:27 -05:00
|
|
|
reply = HTMLField()
|
2017-08-26 11:40:35 -04:00
|
|
|
creator = models.ForeignKey(User)
|
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.reply
|