diff options
Diffstat (limited to 'cms/models.py')
-rw-r--r-- | cms/models.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cms/models.py b/cms/models.py new file mode 100644 index 0000000..1811a70 --- /dev/null +++ b/cms/models.py @@ -0,0 +1,43 @@ +from django.db import models + + +# Create your models here. + +class Nav(models.Model): + name = models.CharField(max=20) + link = models.CharField(max=20) + position = models.IntegerField() + + def __str__(self): + return self.name + + +class SubNav(models.Model): + nav = models.ForeignKey(Nav, on_delete=models.CASCADE) + name = models.CharField(max=20) + link = models.CharField(max=100) + position = models.IntegerField() + + def __str__(self): + return self.name + + +class Page(models.Model): + permalink = models.CharField(max=100, unique=True) + title = models.CharField(max=50) + imports = models.TextField(help_text='External imports like css,js files, will be placed in <head> tag (already ' + 'includes bootstrap4 and jQuery)') + content = models.TextField(help_text='Body of the page') + pub_date = models.DateTimeField('date published', auto_now_add=True) + + def __str__(self): + return self.title + + +class StaticFiles(models.Model): + filename = models.CharField(max=70, unique=True) + file = models.FileField(upload_to='static/{}'.format(filename), blank=False, + help_text='Please upload static files (images, css, js, etc) one by one') + + def __str__(self): + return self.filename |