diff options
author | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-01-30 19:19:30 +0000 |
---|---|---|
committer | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-01-30 19:19:30 +0000 |
commit | 0882d73ca1ba4c84ce24c946548c80d9e4d1c04e (patch) | |
tree | 605e2284e175e80477fd7b6a6e9e2a2fcae94236 /apps/blog/models.py | |
parent | 7300519c054838511ba2584394620d0841b88e5f (diff) |
added topics to posts
Diffstat (limited to 'apps/blog/models.py')
-rw-r--r-- | apps/blog/models.py | 22 |
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',) |