Django e-commerce part22 Social Share
views.py , forms.py の編集
- if new_item.title: をコメントアウト
- forms.pyの、extra=0にする。fieldから、titleを外しておく。
social shareの導入手順を確認
上記を参照にする。
product_detail.html に、facebook shareのリンクを貼るだけ
<a href="https://www.facebook.com/sharer/sharer.php?u=*****************"> Share on Facebook </a>
Font Awesomeを使う
<p> Share</br> <a href="https://www.facebook.com/sharer/sharer.php?u={{ request.build_absolute_uri }}"> <i class="fa fa-facebook-official fa-3x" aria-hidden="true"></i> </a> <a href="#"> <i class="fa fa-twitter-square fa-3x" aria-hidden="true"></i> </a> </p>
こんな感じ。