summaryrefslogtreecommitdiff
path: root/apps/blog/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/blog/models.py')
-rw-r--r--apps/blog/models.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/blog/models.py b/apps/blog/models.py
index 5ff6624..bdbcd82 100644
--- a/apps/blog/models.py
+++ b/apps/blog/models.py
@@ -35,6 +35,17 @@ class PostImage(models.Model):
return force_unicode('<img src="%s%s" alt="%s" class="postpic"/>' % \
(settings.IMAGES_URL, self.image.url.split('images')[1].split('/',1)[1], self.title))
+
+class Topic(models.Model):
+ name = models.CharField(max_length=100)
+ slug = models.SlugField()
+
+ def __unicode__(self):
+ return self.name
+
+ def get_absolute_url(self):
+ return "/topics/%s/" % (self.slug)
+
class Entry(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique_for_date='pub_date')
@@ -56,6 +67,17 @@ class Entry(models.Model):
photo_gallery = models.ForeignKey(PhotoGallery, blank=True, null=True, verbose_name='photo set')
thumbnail = models.FileField(upload_to=get_upload_path, null=True,blank=True)
title_keywords = models.CharField(max_length=200, null=True, blank=True)
+ topics = models.ManyToManyField(Topic, blank=True)
+
+ @property
+ def longitude(self):
+ '''Get the site's longitude.'''
+ return self.point.x
+
+ @property
+ def latitude(self):
+ '''Get the site's latitude.'''
+ return self.point.y
class Meta:
ordering = ('-pub_date',)