Mercurial > public > sg101
comparison smiley/models.py @ 989:2908859c2fe4
Smilies now use relative links.
This is for upcoming switch to SSL. Currently we do not need absolute URLs for
smilies. If this changes we can add it later.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 29 Oct 2015 20:54:34 -0500 |
parents | e14f54f16dbc |
children | 4aadaf3bc234 |
comparison
equal
deleted
inserted
replaced
988:65b2bc9cb3cc | 989:2908859c2fe4 |
---|---|
79 return self.image.url | 79 return self.image.url |
80 | 80 |
81 def html(self): | 81 def html(self): |
82 """Returns a HTML img tag representation of the smiley.""" | 82 """Returns a HTML img tag representation of the smiley.""" |
83 if self.image: | 83 if self.image: |
84 site = Site.objects.get_current() | 84 return (u'<img src="%s" alt="%s" title="%s" />' % |
85 return (u'<img src="http://%s%s" alt="%s" title="%s" />' % | 85 (self.get_absolute_url(), self.title, self.title)) |
86 (site.domain, self.get_absolute_url(), self.title, self.title)) | |
87 return u'' | 86 return u'' |
88 html.allow_tags = True | 87 html.allow_tags = True |
89 | 88 |
90 def markdown(self, relative_urls=True): | 89 def markdown(self, relative_urls=True): |
91 """Returns a markdown representation of the smiley. | 90 """Returns a markdown representation of the smiley. |