khaganat-web/pages/models.py
Rodolphe Breard 85eb1ff03e Refactor the page edition
Markdown has been removed, pages are now directly edited in HTML. To
ease that process, TinyMCE has been added. Also, the admin dashboard now
provides a file management tool in order to upload stuff.
2020-02-28 13:53:57 +01:00

24 lines
725 B
Python

from django.conf import settings
from django.db import models
from tinymce import HTMLField
class Page(models.Model):
slug = models.CharField(max_length=200, unique=True)
default = models.BooleanField(default=False)
is_nsfw = models.BooleanField(default=False)
def __str__(self):
return self.slug
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()
def __str__(self):
return self.title