khaganat-web/pages/models.py

25 lines
725 B
Python
Raw Normal View History

2018-01-13 14:45:54 +00:00
from django.conf import settings
from django.db import models
from tinymce import HTMLField
2018-01-13 14:45:54 +00:00
class Page(models.Model):
slug = models.CharField(max_length=200, unique=True)
default = models.BooleanField(default=False)
2018-06-02 14:03:13 +00:00
is_nsfw = models.BooleanField(default=False)
2018-01-13 14:45:54 +00:00
def __str__(self):
return self.slug
2018-01-27 22:12:09 +00:00
2018-01-13 14:45:54 +00:00
class PageContent(models.Model):
page = models.ForeignKey(Page, on_delete=models.CASCADE)
language = models.CharField(max_length=10, choices=settings.LANGUAGES)
created_on = models.DateTimeField(auto_now_add=True)
edited_on = models.DateTimeField(auto_now=True)
title = models.CharField(max_length=200)
content = HTMLField()
2018-02-25 19:46:41 +00:00
2018-01-13 14:45:54 +00:00
def __str__(self):
return self.title