Mercurial > public > sg101
comparison gpp/forums/models.py @ 556:70722b7d10af
For bitbucket issue #1, add open graph meta tags to forum topics.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 29 Jan 2012 14:42:42 -0600 |
parents | 9e42e6618168 |
children |
comparison
equal
deleted
inserted
replaced
553:abc4be5a82e5 | 556:70722b7d10af |
---|---|
254 return u"%s by %s; %s" % (self.name, self.user.username, post_text) | 254 return u"%s by %s; %s" % (self.name, self.user.username, post_text) |
255 | 255 |
256 def search_summary(self): | 256 def search_summary(self): |
257 return u'' | 257 return u'' |
258 | 258 |
259 def ogp_tags(self): | |
260 """ | |
261 Returns a dict of Open Graph Protocol meta tags. | |
262 | |
263 """ | |
264 desc = 'Forum topic created by %s on %s.' % ( | |
265 self.user.username, | |
266 self.creation_date.strftime('%B %d, %Y')) | |
267 | |
268 return { | |
269 'og:title': self.name, | |
270 'og:type': 'article', | |
271 'og:url': self.get_absolute_url(), | |
272 'og:description': desc, | |
273 } | |
274 | |
259 | 275 |
260 class Post(models.Model): | 276 class Post(models.Model): |
261 """ | 277 """ |
262 A post is an instance of a user's single contribution to a topic. | 278 A post is an instance of a user's single contribution to a topic. |
263 """ | 279 """ |