khaganat-web/pages/models.py

23 lines
653 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
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 = models.TextField()
def __str__(self):
return self.title