summaryrefslogtreecommitdiff
path: root/app/blog/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2013-05-24 21:41:02 -0400
committerluxagraf <sng@luxagraf.net>2013-05-24 21:41:02 -0400
commit7ba10b77f38576b688d7833237e2ec3f36c3292a (patch)
tree2d651f34acc63fc83f6c76be1708fe9e4279d000 /app/blog/models.py
parent69173ab423b281b34972819b60a1b92372e2a145 (diff)
changed backend code to validate location using only the point and prompt if no location exists
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):