summaryrefslogtreecommitdiff
path: root/app/blog/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/blog/models.py')
-rw-r--r--app/blog/models.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/blog/models.py b/app/blog/models.py
index b7c7d87..80ec303 100644
--- a/app/blog/models.py
+++ b/app/blog/models.py
@@ -116,6 +116,10 @@ class Entry(models.Model):
md = image_url_replace(self.body_markdown)
self.body_html = markdown.markdown(md, extensions=['extra',], safe_mode = False)
self.dek == markdown.markdown(self.dek, safe_mode = False)
+ try:
+ 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 EntryAside(models.Model):