master
Nick Sergeant 2012-01-17 00:07:15 -05:00
parent 593075983d
commit fb8a5f01c1
3 changed files with 12 additions and 2 deletions

View File

@ -47,6 +47,16 @@ class Snipt(models.Model):
def get_absolute_url(self):
return "/%s/%s/" % (self.user.username, self.slug)
def get_full_absolute_url(self):
if settings.DEBUG:
root = 'http://snipt.localhost'
else:
if settings.USE_HTTPS:
root = 'https://snipt.net'
else:
root = 'http://snipt.net'
return "%s/%s/%s/" % (root, self.user.username, self.slug)
#TODO This needs to be deprecated - render stylized version on save
def get_stylized(self):
if self.stylized == '':

View File

@ -21,7 +21,7 @@
{% if debug %}
var disqus_developer = 1;
{% endif %}
var disqus_url = ('https:' == document.location.protocol ? 'https' : 'http') + '://snipt.net{{ snipt.get_absolute_url }}';
var disqus_url = '{{ snipt.get_full_absolute_url }}';
var disqus_title = '{{ snipt.title }}';
var disqus_identifier = {{ snipt.id }};

View File

@ -56,7 +56,7 @@
<ul class="attrs">
<li class="author"><a href="{{ snipt.user.get_absolute_url }}">{{ snipt.user.username }}</a></li>
<li class="created">{{ snipt.created|naturalday }}</li>
<li class="comments"><a href="{{ snipt.get_absolute_url }}#disqus_thread" data-disqus-identifier="{{ snipt.id }}"></a></li>
<li class="comments"><a href="{{ snipt.get_full_absolute_url }}#disqus_thread" data-disqus-identifier="{{ snipt.id }}"></a></li>
</ul>
</footer>
</article>