diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/jrnl/admin.py | 8 | ||||
-rw-r--r-- | app/jrnl/migrations/0001_initial.py | 76 | ||||
-rw-r--r-- | app/jrnl/migrations/0002_entrytitlesong.py | 32 | ||||
-rw-r--r-- | app/jrnl/migrations/0003_auto_20160309_1018.py | 31 | ||||
-rw-r--r-- | app/jrnl/migrations/0004_auto_20160309_1031.py | 30 | ||||
-rw-r--r-- | app/jrnl/migrations/__init__.py | 0 | ||||
-rw-r--r-- | app/jrnl/models.py | 27 |
7 files changed, 203 insertions, 1 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py index c19f972..4a241b4 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, EntryAside, PostImage, HomepageCurrator +from .models import Entry, EntryAside, PostImage, HomepageCurrator, EntryTitleSong class EntryAsideInline(admin.TabularInline): @@ -15,6 +15,12 @@ class EntryAsideAdmin(admin.ModelAdmin): pass +@admin.register(EntryTitleSong) +class EntryTitleSongAdmin(admin.ModelAdmin): + list_display = ('title', 'band', 'album', 'song') + exclude = ('body_html', 'slug', 'pub_date') + + class EntryAdmin(OSMGeoAdmin): form = LGEntryForm inlines = [EntryAsideInline] diff --git a/app/jrnl/migrations/0001_initial.py b/app/jrnl/migrations/0001_initial.py new file mode 100644 index 0000000..fb2542e --- /dev/null +++ b/app/jrnl/migrations/0001_initial.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:13 +from __future__ import unicode_literals + +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import jrnl.models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('locations', '__first__'), + ('photos', '0003_luxgallery_caption_style'), + ] + + operations = [ + migrations.CreateModel( + name='Entry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('slug', models.SlugField(unique_for_date='pub_date')), + ('body_html', models.TextField(blank=True)), + ('body_markdown', models.TextField()), + ('dek', models.TextField(blank=True, null=True)), + ('pub_date', models.DateTimeField(verbose_name='Date published')), + ('enable_comments', models.BooleanField(default=False)), + ('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0)), + ('image', models.FileField(blank=True, help_text='should be 205px high', null=True, upload_to=jrnl.models.get_upload_path)), + ('thumbnail', models.FileField(blank=True, help_text='should be 160 wide', null=True, upload_to=jrnl.models.get_tn_path)), + ('meta_description', models.CharField(blank=True, max_length=256, null=True)), + ('template_name', models.IntegerField(choices=[(0, 'single'), (1, 'double'), (2, 'single-dark'), (3, 'double-dark'), (4, 'bigimg'), (5, 'bigimg-dark')], default=0)), + ('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='locations.Location')), + ('photo_gallery', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.PhotoGallery', verbose_name='photo set')), + ], + options={ + 'verbose_name_plural': 'entries', + 'get_latest_by': 'pub_date', + 'ordering': ('-pub_date',), + }, + ), + migrations.CreateModel( + name='EntryAside', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('body', models.TextField(blank=True, null=True)), + ('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='jrnl.Entry')), + ], + ), + migrations.CreateModel( + name='HomepageCurrator', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('alt_text', models.CharField(max_length=200)), + ('image_base_url', models.CharField(max_length=200)), + ('tag_line', models.CharField(max_length=200)), + ('template_name', models.CharField(help_text='full path', max_length=200)), + ('banner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banner', to='jrnl.Entry')), + ('entry_list', models.ManyToManyField(to='jrnl.Entry')), + ], + ), + migrations.CreateModel( + name='PostImage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=100)), + ('image', models.ImageField(upload_to='/Users/sng/Sites/luxagraf/site/media/images/2016')), + ], + ), + ] diff --git a/app/jrnl/migrations/0002_entrytitlesong.py b/app/jrnl/migrations/0002_entrytitlesong.py new file mode 100644 index 0000000..66a75a6 --- /dev/null +++ b/app/jrnl/migrations/0002_entrytitlesong.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:13 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='EntryTitleSong', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('slug', models.SlugField(unique_for_date='pub_date')), + ('body_html', models.TextField(blank=True)), + ('pub_date', models.DateField(verbose_name='Date published')), + ('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='jrnl.Entry')), + ], + options={ + 'ordering': ('-pub_date',), + 'get_latest_by': 'pub_date', + 'verbose_name_plural': 'Entry Title Songs', + }, + ), + ] diff --git a/app/jrnl/migrations/0003_auto_20160309_1018.py b/app/jrnl/migrations/0003_auto_20160309_1018.py new file mode 100644 index 0000000..49a3f6f --- /dev/null +++ b/app/jrnl/migrations/0003_auto_20160309_1018.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:18 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0002_entrytitlesong'), + ] + + operations = [ + migrations.AddField( + model_name='entrytitlesong', + name='album', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AddField( + model_name='entrytitlesong', + name='band', + field=models.CharField(default='none', max_length=200), + preserve_default=False, + ), + migrations.AddField( + model_name='entrytitlesong', + name='song', + field=models.CharField(blank=True, max_length=200, null=True), + ), + ] diff --git a/app/jrnl/migrations/0004_auto_20160309_1031.py b/app/jrnl/migrations/0004_auto_20160309_1031.py new file mode 100644 index 0000000..33bbe05 --- /dev/null +++ b/app/jrnl/migrations/0004_auto_20160309_1031.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-03-09 10:31 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0003_auto_20160309_1018'), + ] + + operations = [ + migrations.AddField( + model_name='entrytitlesong', + name='body_markdown', + field=models.TextField(blank=True), + ), + migrations.AddField( + model_name='entrytitlesong', + name='listen_link', + field=models.CharField(blank=True, max_length=200, null=True), + ), + migrations.AlterField( + model_name='entrytitlesong', + name='slug', + field=models.SlugField(blank=True, unique_for_date='pub_date'), + ), + ] diff --git a/app/jrnl/migrations/__init__.py b/app/jrnl/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/jrnl/migrations/__init__.py diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 8e86c62..5c2a11d 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -8,6 +8,7 @@ from django.conf import settings from django.contrib.syndication.views import Feed from django.contrib.sitemaps import Sitemap from django import forms +from django.template.defaultfilters import slugify # http://freewisdom.org/projects/python-markdown/ import markdown @@ -168,6 +169,32 @@ class Entry(models.Model): super(Entry, self).save() +class EntryTitleSong(models.Model): + title = models.CharField(max_length=200) + band = models.CharField(max_length=200) + album = models.CharField(max_length=200, blank=True, null=True) + song = models.CharField(max_length=200, blank=True, null=True) + listen_link = models.CharField(max_length=200, blank=True, null=True) + entry = models.ForeignKey(Entry) + slug = models.SlugField(unique_for_date='pub_date', blank=True) + body_markdown = models.TextField(blank=True) + body_html = models.TextField(blank=True) + pub_date = models.DateField('Date published') + + class Meta: + ordering = ('-pub_date',) + get_latest_by = 'pub_date' + verbose_name_plural = 'Entry Title Songs' + + def __str__(self): + return self.title + + def save(self): + if not self.id and not self.pub_date: + self.pub_date = datetime.datetime.now() + self.slug = slugify(self.title) + + class EntryAside(models.Model): title = models.CharField(max_length=200) body = models.TextField(null=True, blank=True) |