Commits

Ian Lewis committed 952ed54

Added hatena bookmark links to blog_detail pages

  • Participants
  • Parent commits c3ddb11

Comments (0)

Files changed (2)

File blog/models.py

 #:coding=utf8:
 
+from django.contrib.sites.models import Site
 from django.contrib.auth.models import User
 from tagging.models import *
 from django.db.models import *
             'locale': self.locale,
             'slug': self.slug,
         })
+    
+    def get_full_url(self):
+        return 'http://%s%s' % (Site.objects.get_current().domain, self.get_absolute_url())
 
     class Meta:
         verbose_name = _("post")

File templates/blog/post_detail.html

      
   {% endif %}
   </div>
+  <div class="post-comment-link"> 
+      <a href="http://b.hatena.ne.jp/entry/{{ object.get_full_url }}">
+        <img src="http://d.hatena.ne.jp/images/b_entry.gif" width="16" height="12" style="border: none;"
+   alt="このエントリーを含むはてなブックマーク" title="このエントリーを含むはてなブックマーク" />
+        <img src="http://b.hatena.ne.jp/entry/image/{{ object.get_full_url }}" alt="はてなブックマーク - {{ object.title }}" title="はてなブックマーク - {{ object.title }}">
+    </a>
+  </div>
+  
   <div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/ianlewisblog/embed.js"></script><noscript><a href="http://ianlewisblog.disqus.com/?url=ref">View the discussion thread.</a></noscript>
 
 </div>