summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/jrnl/admin.py2
-rw-r--r--app/jrnl/migrations/0017_entry_field_notes.py19
-rw-r--r--app/jrnl/models.py2
-rw-r--r--app/sketches/migrations/0002_auto_20180208_0743.py17
-rw-r--r--app/sketches/models.py4
5 files changed, 43 insertions, 1 deletions
diff --git a/app/jrnl/admin.py b/app/jrnl/admin.py
index 5fcdc89..7d94b47 100644
--- a/app/jrnl/admin.py
+++ b/app/jrnl/admin.py
@@ -24,6 +24,7 @@ class EntryAdmin(OSMGeoAdmin):
search_fields = ['title', 'body_markdown']
prepopulated_fields = {"slug": ('title',)}
list_filter = ('pub_date', 'enable_comments', 'status', 'location__state__country__lux_region')
+ filter_horizontal = ('field_notes',)
fieldsets = (
('Entry', {
'fields': (
@@ -48,6 +49,7 @@ class EntryAdmin(OSMGeoAdmin):
('image', 'thumbnail'),
'template_name',
'enable_comments',
+ 'field_notes',
),
}),
)
diff --git a/app/jrnl/migrations/0017_entry_field_notes.py b/app/jrnl/migrations/0017_entry_field_notes.py
new file mode 100644
index 0000000..e013d5d
--- /dev/null
+++ b/app/jrnl/migrations/0017_entry_field_notes.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.0.1 on 2018-02-08 07:43
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sketches', '0002_auto_20180208_0743'),
+ ('jrnl', '0016_auto_20161219_1058'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='entry',
+ name='field_notes',
+ field=models.ManyToManyField(to='sketches.Sketch'),
+ ),
+ ]
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index b9018bf..17909df 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -20,6 +20,7 @@ from bs4 import BeautifulSoup
from photos.models import PhotoGallery, LuxImage
from locations.models import Location
+from sketches.models import Sketch
from utils.widgets import parse_image, parse_video
from utils.widgets import markdown_to_html
@@ -84,6 +85,7 @@ class Entry(models.Model):
template_name = models.IntegerField(choices=TEMPLATES, default=0)
featured_image = models.ForeignKey(LuxImage, on_delete=models.CASCADE, null=True, blank=True)
has_video = models.BooleanField(blank=True, default=False)
+ field_notes = models.ManyToManyField(Sketch)
class Meta:
ordering = ('-pub_date',)
diff --git a/app/sketches/migrations/0002_auto_20180208_0743.py b/app/sketches/migrations/0002_auto_20180208_0743.py
new file mode 100644
index 0000000..664fcbc
--- /dev/null
+++ b/app/sketches/migrations/0002_auto_20180208_0743.py
@@ -0,0 +1,17 @@
+# Generated by Django 2.0.1 on 2018-02-08 07:43
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sketches', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='sketch',
+ options={'get_latest_by': 'pub_date', 'ordering': ('-pub_date',), 'verbose_name_plural': 'sketches'},
+ ),
+ ]
diff --git a/app/sketches/models.py b/app/sketches/models.py
index 2d7f9ac..02fa766 100644
--- a/app/sketches/models.py
+++ b/app/sketches/models.py
@@ -7,9 +7,11 @@ from django.urls import reverse
from utils.widgets import markdown_to_html
from locations.models import CheckIn
-from jrnl.models import render_images
+def render_images(s):
+ s = re.sub('<img(.*)/>', parse_image, s)
+ return s
class Sketch(models.Model):
title = models.CharField(max_length=250, null=True, blank=True)