summaryrefslogtreecommitdiff
path: root/app/pages
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-11-25 15:04:32 -0500
committerluxagraf <sng@luxagraf.net>2020-11-25 15:04:32 -0500
commitef650eac7c46701974695868101e465308215c6a (patch)
tree58c9e2e334b0a194a452c6257d20dd47fd3f1da4 /app/pages
parentf9f2ef6d817ea34299521e10ba5a559b9879d773 (diff)
added featured image to pages
Diffstat (limited to 'app/pages')
-rw-r--r--app/pages/admin.py10
-rw-r--r--app/pages/migrations/0010_page_featured_image.py20
-rw-r--r--app/pages/models.py1
3 files changed, 30 insertions, 1 deletions
diff --git a/app/pages/admin.py b/app/pages/admin.py
index b7c8962..bd37223 100644
--- a/app/pages/admin.py
+++ b/app/pages/admin.py
@@ -25,7 +25,7 @@ class PageAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ('title',)}
fieldsets = (
('Page', {
- 'fields': ('title', 'sub_title', 'body_markdown', ('build', 'enable_comments'), ('site','slug', 'path', 'app')),
+ 'fields': ('title', 'sub_title', 'body_markdown', ('build', 'enable_comments'), ('site','slug', 'path', 'app'), 'featured_image'),
'classes': ('show', 'extrapretty', 'wide')
}),
('Metadata', {
@@ -34,6 +34,14 @@ class PageAdmin(admin.ModelAdmin):
})
)
+ class Media:
+ js = ('image-loader.js', 'product-loader.js', 'next-prev-links.js')
+ css = {
+ "all": ("my_styles.css",)
+ }
+
+
+
@admin.register(HomePage)
class HomePageAdmin(admin.ModelAdmin):
diff --git a/app/pages/migrations/0010_page_featured_image.py b/app/pages/migrations/0010_page_featured_image.py
new file mode 100644
index 0000000..931403f
--- /dev/null
+++ b/app/pages/migrations/0010_page_featured_image.py
@@ -0,0 +1,20 @@
+# Generated by Django 3.1 on 2020-11-25 15:02
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('photos', '0019_auto_20190704_0903'),
+ ('pages', '0009_page_site'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='page',
+ name='featured_image',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.luximage'),
+ ),
+ ]
diff --git a/app/pages/models.py b/app/pages/models.py
index fac815c..d3473a6 100644
--- a/app/pages/models.py
+++ b/app/pages/models.py
@@ -20,6 +20,7 @@ class Page(models.Model):
build = models.BooleanField(default=True)
enable_comments = models.BooleanField(default=False)
site = models.ForeignKey(Site, on_delete=models.CASCADE)
+ featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True)
def __str__(self):
return self.title