summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/jrnl/models.py4
-rw-r--r--app/lib/django_comments/views/utils.py2
-rw-r--r--app/utils/views.py2
3 files changed, 5 insertions, 3 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index 522764d..6dab4b9 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -174,8 +174,10 @@ 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))
+ if created and not self.featured_image:
+ self.featured_image = LuxImage.objects.latest()
old = type(self).objects.get(pk=self.pk) if self.pk else None
- if old and old.featured_image != self.featured_image or created: # Field has changed
+ if old and old.featured_image != self.featured_image: # Field has changed
s = LuxImageSize.objects.get(name="featured_jrnl")
self.featured_image.sizes.add(s)
self.featured_image.save()
diff --git a/app/lib/django_comments/views/utils.py b/app/lib/django_comments/views/utils.py
index 557e673..a5f5c11 100644
--- a/app/lib/django_comments/views/utils.py
+++ b/app/lib/django_comments/views/utils.py
@@ -28,7 +28,7 @@ def next_redirect(request, fallback, **get_kwargs):
Returns an ``HttpResponseRedirect``.
"""
next = request.POST.get('next')
- if not is_safe_url(url=next, host=request.get_host()):
+ if not is_safe_url(url=next, allowed_hosts={request.get_host()}):
next = resolve_url(fallback)
if get_kwargs:
diff --git a/app/utils/views.py b/app/utils/views.py
index 49b701b..dcb16a8 100644
--- a/app/utils/views.py
+++ b/app/utils/views.py
@@ -30,7 +30,7 @@ def insert_image(request):
"""
The view that handles the admin insert image/video feature
"""
- images = LuxImage.objects.all()[:50]
+ images = LuxImage.objects.all()[:80]
videos = LuxVideo.objects.all()[:10]
object_list = sorted(
chain(images, videos),