diff options
author | luxagraf <sng@luxagraf.net> | 2018-09-02 10:15:59 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-09-02 10:15:59 -0600 |
commit | 0e15bfaaa7b2ded3af49911f0c3cbeaec55a653c (patch) | |
tree | 84fa8316c1be16fe2c8cd942c153f75665311cae | |
parent | bbe0feb98ae3367ce730bdf7c62aef653d89f1f0 (diff) |
changed Homepage Currator model
-rw-r--r-- | app/jrnl/admin.py | 14 | ||||
-rw-r--r-- | app/jrnl/models.py | 14 |
2 files changed, 27 insertions, 1 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py index 7f12087..94759c0 100644 --- a/app/jrnl/admin.py +++ b/app/jrnl/admin.py @@ -3,7 +3,7 @@ from django import forms from django.contrib.gis.admin import OSMGeoAdmin from utils.widgets import AdminImageWidget, LGEntryForm -from .models import Entry, HomepageCurrator +from .models import Entry, HomepageCurrator, Home from photos.forms import GalleryForm from photos.models import LuxImage @@ -96,3 +96,15 @@ class HomepageCurratorAdmin(admin.ModelAdmin): css = { "all": ("my_styles.css",) } + + +@admin.register(Home) +class HomeAdmin(admin.ModelAdmin): + form = GalleryForm + filter_horizontal = ('popular',) + + class Media: + js = ('image-loader.js', 'next-prev-links.js') + css = { + "all": ("my_styles.css",) + } diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 8fe3cb0..8952eef 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -191,6 +191,19 @@ class HomepageCurrator(models.Model): """ image_offset_vertical = models.CharField(max_length=20, help_text="add negative top margin to shift image (include css unit)") images = models.ManyToManyField(LuxImage) + #featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) + tag_line = models.CharField(max_length=200) + featured = models.ForeignKey(Entry, on_delete=models.CASCADE, related_name="oldbanner") + popular = models.ManyToManyField(Entry) + template_name = models.CharField(max_length=200, help_text="full path") + + +class Home(models.Model): + """ + simple model to control the featured article on the homepage + also allows me to fudge the "popular" section to be what I want + """ + image_offset_vertical = models.CharField(max_length=20, help_text="add negative top margin to shift image (include css unit)") featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True) tag_line = models.CharField(max_length=200) featured = models.ForeignKey(Entry, on_delete=models.CASCADE, related_name="banner") @@ -226,6 +239,7 @@ class EntryModerator(CommentModerator): # do entry build right here so it goes to live site return True + moderator.register(Entry, EntryModerator) |