diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/jrnl/admin.py | 10 | ||||
-rw-r--r-- | app/jrnl/migrations/0006_auto_20160715_0703.py | 37 | ||||
-rw-r--r-- | app/jrnl/migrations/0007_delete_postimage.py | 18 | ||||
-rw-r--r-- | app/jrnl/models.py | 18 |
4 files changed, 60 insertions, 23 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py index d493053..54a1046 100644 --- a/app/jrnl/admin.py +++ b/app/jrnl/admin.py @@ -3,7 +3,9 @@ from django import forms from django.contrib.gis.admin import OSMGeoAdmin from utils.widgets import AdminImageWidget, LGEntryForm -from .models import Entry, EntryAside, PostImage, HomepageCurrator, EntryTitleSong +from .models import Entry, EntryAside, HomepageCurrator, EntryTitleSong + +from photos.forms import GalleryForm class EntryAsideInline(admin.TabularInline): @@ -76,16 +78,12 @@ class EntryAdmin(OSMGeoAdmin): openlayers_url = '/static/admin/js/OpenLayers.js' -class PostImageAdmin(admin.ModelAdmin): - list_display = ('title', 'post_image') - - class HomepageCurratorAdmin(admin.ModelAdmin): + form = GalleryForm filter_horizontal = ('entry_list',) pass -admin.site.register(PostImage, PostImageAdmin) admin.site.register(EntryAside, EntryAsideAdmin) admin.site.register(Entry, EntryAdmin) admin.site.register(HomepageCurrator, HomepageCurratorAdmin) diff --git a/app/jrnl/migrations/0006_auto_20160715_0703.py b/app/jrnl/migrations/0006_auto_20160715_0703.py new file mode 100644 index 0000000..42efc43 --- /dev/null +++ b/app/jrnl/migrations/0006_auto_20160715_0703.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-15 07:03 +from __future__ import unicode_literals + +from django.db import migrations, models +import jrnl.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0010_auto_20160517_0906'), + ('jrnl', '0005_auto_20160514_2151'), + ] + + operations = [ + migrations.AddField( + model_name='homepagecurrator', + name='images', + field=models.ManyToManyField(to='photos.LuxImage'), + ), + migrations.AlterField( + model_name='entry', + name='image', + field=models.FileField(blank=True, help_text='should be 205px high by 364px wide', null=True, upload_to=jrnl.models.get_upload_path), + ), + migrations.AlterField( + model_name='entry', + name='template_name', + field=models.IntegerField(choices=[(0, 'single'), (1, 'double'), (2, 'single-dark'), (3, 'double-dark'), (4, 'single-black'), (5, 'double-black')], default=0), + ), + migrations.AlterField( + model_name='postimage', + name='image', + field=models.ImageField(upload_to='/home/lxf/Sites/luxagraf/site/media/images/2016'), + ), + ] diff --git a/app/jrnl/migrations/0007_delete_postimage.py b/app/jrnl/migrations/0007_delete_postimage.py new file mode 100644 index 0000000..cc481e8 --- /dev/null +++ b/app/jrnl/migrations/0007_delete_postimage.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-07-15 07:05 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0006_auto_20160715_0703'), + ] + + operations = [ + migrations.DeleteModel( + name='PostImage', + ), + ] diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 874da74..da6d947 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -76,23 +76,6 @@ def extract_images(s): return imgs -class PostImage(models.Model): - title = models.CharField(max_length=100) - image = models.ImageField(upload_to="%s/%s" % (settings.IMAGES_ROOT, datetime.datetime.today().strftime("%Y"))) - - def __unicode__(self): - return self.title - - def post_image(self): - return format_html('<img src="%s%s" alt="%s" class="postpic"/>' % ( - settings.IMAGES_URL, - self.image.url.split('images')[1].split('/', 1)[1], - self.title) - ) - - post_image.allow_tags = True - - class Entry(models.Model): title = models.CharField(max_length=200) slug = models.SlugField(unique_for_date='pub_date') @@ -247,6 +230,7 @@ class EntryAside(models.Model): class HomepageCurrator(models.Model): alt_text = models.CharField(max_length=200) image_base_url = models.CharField(max_length=200) + images = models.ManyToManyField(LuxImage) tag_line = models.CharField(max_length=200) banner = models.ForeignKey(Entry, related_name="banner") entry_list = models.ManyToManyField(Entry) |