diff options
Diffstat (limited to 'app/jrnl')
-rw-r--r-- | app/jrnl/admin.py | 26 | ||||
-rw-r--r-- | app/jrnl/migrations/0010_auto_20161102_0916.py | 22 | ||||
-rw-r--r-- | app/jrnl/migrations/0011_auto_20161102_0925.py | 22 | ||||
-rw-r--r-- | app/jrnl/migrations/0012_auto_20161102_0930.py | 30 | ||||
-rw-r--r-- | app/jrnl/migrations/0013_entry_featured_image.py | 22 | ||||
-rw-r--r-- | app/jrnl/migrations/0014_homepagecurrator.py | 29 | ||||
-rw-r--r-- | app/jrnl/models.py | 35 | ||||
-rw-r--r-- | app/jrnl/urls.py | 5 | ||||
-rw-r--r-- | app/jrnl/views.py | 4 |
9 files changed, 130 insertions, 65 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py index b49837a..e71b733 100644 --- a/app/jrnl/admin.py +++ b/app/jrnl/admin.py @@ -3,30 +3,14 @@ from django import forms from django.contrib.gis.admin import OSMGeoAdmin from utils.widgets import AdminImageWidget, LGEntryForm -from .models import Entry, EntryAside, HomepageCurrator, EntryTitleSong +from .models import Entry, HomepageCurrator from photos.forms import GalleryForm -class EntryAsideInline(admin.TabularInline): - model = EntryAside - extra = 1 - - -class EntryAsideAdmin(admin.ModelAdmin): - pass - - -@admin.register(EntryTitleSong) -class EntryTitleSongAdmin(admin.ModelAdmin): - list_display = ('title', 'band', 'album', 'song') - list_filter = ('band',) - exclude = ('title', 'body_html', 'slug', 'pub_date') - - +@admin.register(Entry) class EntryAdmin(OSMGeoAdmin): form = LGEntryForm - inlines = [EntryAsideInline] def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'thumbnail' or db_field.name == 'image': @@ -78,12 +62,8 @@ class EntryAdmin(OSMGeoAdmin): openlayers_url = '/static/admin/js/OpenLayers.js' +@admin.register(HomepageCurrator) class HomepageCurratorAdmin(admin.ModelAdmin): form = GalleryForm filter_horizontal = ('popular',) pass - - -admin.site.register(EntryAside, EntryAsideAdmin) -admin.site.register(Entry, EntryAdmin) -admin.site.register(HomepageCurrator, HomepageCurratorAdmin) diff --git a/app/jrnl/migrations/0010_auto_20161102_0916.py b/app/jrnl/migrations/0010_auto_20161102_0916.py new file mode 100644 index 0000000..a2d9eb8 --- /dev/null +++ b/app/jrnl/migrations/0010_auto_20161102_0916.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:16 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0009_homepagecurrator_image_offset_vertical'), + ] + + operations = [ + migrations.RemoveField( + model_name='entryaside', + name='entry', + ), + migrations.DeleteModel( + name='EntryAside', + ), + ] diff --git a/app/jrnl/migrations/0011_auto_20161102_0925.py b/app/jrnl/migrations/0011_auto_20161102_0925.py new file mode 100644 index 0000000..e11c1ba --- /dev/null +++ b/app/jrnl/migrations/0011_auto_20161102_0925.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:25 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0010_auto_20161102_0916'), + ] + + operations = [ + migrations.RemoveField( + model_name='entrytitlesong', + name='entry', + ), + migrations.DeleteModel( + name='EntryTitleSong', + ), + ] diff --git a/app/jrnl/migrations/0012_auto_20161102_0930.py b/app/jrnl/migrations/0012_auto_20161102_0930.py new file mode 100644 index 0000000..d1a65dd --- /dev/null +++ b/app/jrnl/migrations/0012_auto_20161102_0930.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:30 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('jrnl', '0011_auto_20161102_0925'), + ] + + operations = [ + migrations.RemoveField( + model_name='homepagecurrator', + name='featured', + ), + migrations.RemoveField( + model_name='homepagecurrator', + name='images', + ), + migrations.RemoveField( + model_name='homepagecurrator', + name='popular', + ), + migrations.DeleteModel( + name='HomepageCurrator', + ), + ] diff --git a/app/jrnl/migrations/0013_entry_featured_image.py b/app/jrnl/migrations/0013_entry_featured_image.py new file mode 100644 index 0000000..c607ca7 --- /dev/null +++ b/app/jrnl/migrations/0013_entry_featured_image.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('jrnl', '0012_auto_20161102_0930'), + ] + + operations = [ + migrations.AddField( + model_name='entry', + name='featured_image', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='photos.LuxImage'), + ), + ] diff --git a/app/jrnl/migrations/0014_homepagecurrator.py b/app/jrnl/migrations/0014_homepagecurrator.py new file mode 100644 index 0000000..2d34866 --- /dev/null +++ b/app/jrnl/migrations/0014_homepagecurrator.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-11-02 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('photos', '0016_auto_20161022_1411'), + ('jrnl', '0013_entry_featured_image'), + ] + + operations = [ + migrations.CreateModel( + name='HomepageCurrator', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image_offset_vertical', models.CharField(help_text='add negative top margin to shift image (include css unit)', max_length=20)), + ('tag_line', models.CharField(max_length=200)), + ('template_name', models.CharField(help_text='full path', max_length=200)), + ('featured', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banner', to='jrnl.Entry')), + ('images', models.ManyToManyField(to='photos.LuxImage')), + ('popular', models.ManyToManyField(to='jrnl.Entry')), + ], + ), + ] diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 2fc775e..340b718 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -108,6 +108,7 @@ class Entry(models.Model): (5, 'double-black'), ) template_name = models.IntegerField(choices=TEMPLATES, default=0) + featured_image = models.ForeignKey(LuxImage, null=True, blank=True) class Meta: ordering = ('-pub_date',) @@ -194,41 +195,9 @@ class Entry(models.Model): self.location = Location.objects.filter(geometry__contains=self.point).get() except Location.DoesNotExist: raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL)) - super(Entry, self).save() - - -class EntryTitleSong(models.Model): - title = models.CharField(max_length=200, blank=True) - 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) - self.title = self.entry.title - super(EntryTitleSong, self).save() + super(Entry, self).save() -class EntryAside(models.Model): - title = models.CharField(max_length=200) - body = models.TextField(null=True, blank=True) - entry = models.ForeignKey(Entry) class HomepageCurrator(models.Model): diff --git a/app/jrnl/urls.py b/app/jrnl/urls.py index c1cdcdc..aa01d69 100644 --- a/app/jrnl/urls.py +++ b/app/jrnl/urls.py @@ -17,11 +17,6 @@ urlpatterns = [ name="detail-txt" ), url( - r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+).amp$', - views.EntryDetailViewAMP.as_view(), - name="detail-amp" - ), - url( r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<slug>[-\w]+)$', views.EntryDetailView.as_view(), name="detail" diff --git a/app/jrnl/views.py b/app/jrnl/views.py index 6d0e85b..b27ab96 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -76,10 +76,6 @@ class EntryDetailViewTXT(EntryDetailView): template_name = "details/entry.txt" -class EntryDetailViewAMP(EntryDetailView): - template_name = "details/entry.amp" - - class HomepageList(ListView): """ Return a main entry and list of Entries in reverse chronological order |