|
|
|
|
@ -4,6 +4,7 @@ from django.conf import settings |
|
|
|
|
from django.db.models import Q |
|
|
|
|
from django.utils.text import slugify |
|
|
|
|
from enum import Enum |
|
|
|
|
import string |
|
|
|
|
|
|
|
|
|
# Create your models here. |
|
|
|
|
class PostState(Enum): |
|
|
|
|
@ -61,6 +62,9 @@ class Post(models.Model): |
|
|
|
|
return self.title |
|
|
|
|
return 'Poker Rumble - Amazing content' |
|
|
|
|
|
|
|
|
|
def formatted_title(self): |
|
|
|
|
return string.capwords(self.title) |
|
|
|
|
|
|
|
|
|
class Comment(models.Model): |
|
|
|
|
author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) |
|
|
|
|
post = models.ForeignKey(Post, on_delete=models.CASCADE) |
|
|
|
|
|