khaganat-web/pages/models.py

22 lines
652 B
Python
Raw Normal View History

2018-01-13 14:45:54 +00:00
from django.conf import settings
from django.db import models
class Page(models.Model):
slug = models.CharField(max_length=200, unique=True)
default = 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 = models.TextField()
def __str__(self):
return self.title