wedding-site-backend/wedding_site/primary/models.py

36 lines
1.1 KiB
Python
Raw Normal View History

2024-02-11 15:26:29 +00:00
from django.db import models
class Site(models.Model):
name = models.CharField(max_length=200, default="")
title = models.CharField(max_length=200)
header = models.TextField(default="")
page_header = models.TextField(default="")
index = models.TextField()
password = models.CharField(max_length=200, default="")
def __str__(self):
return self.name
class Page(models.Model):
site = models.ForeignKey(Site, on_delete=models.CASCADE)
content = models.TextField()
name = models.CharField(max_length=200)
pretty_name = models.CharField(max_length=200, default="")
published = models.BooleanField(default=False)
navigable = models.BooleanField(default=False)
2024-02-18 10:51:57 +00:00
priority = models.IntegerField(default=0)
2024-02-11 15:26:29 +00:00
def __str__(self):
return self.name
class Image(models.Model):
name = models.CharField(max_length=200)
content = models.ImageField(upload_to="uploads",
width_field="width", height_field="height", default=None)
width = models.IntegerField(default=0)
height = models.IntegerField(default=0)
alt_text = models.TextField()
def __str__(self):
return self.name