一个可重复使用的django应用程序,它呈现一组社交媒体链接,即用于您的网站页脚。
django-social-media-links的Python项目详细描述
一个可重用的django应用程序,提供一组社交媒体链接,例如 网站页脚。
安装
从pypi获得最新的稳定版本:
$ pip install django-social-media-links
从github获取最新提交:
$ pip install -e git+git://github.com/bitmazk/django-social-media-links.git#egg=social_media_links
将social_media_links添加到INSTALLED_APPS:
INSTALLED_APPS = ( ..., 'social_media_links', )
不要忘记迁移数据库:
./manage.py migrate social_media_links
如果您想使用由提供的社交图标 [monosocialfont](http://drinchev.github.io/monosocialiconsfont/)您应该添加 以下样式表指向您的base.html:
<head> <link href="{% static "social_media_links/css/styles.css" %}" rel="stylesheet" media="screen"> </head> <body> // Use it like so: <span class="symbol"></span> </body>
用法
首先需要创建一组LinkType对象。您可能要分配 他们的象征。为了找出这些符号的代码,请参考 到http://drinchev.github.io/monosocialiconsfont/
我们提供一个作业标签,返回您的 数据库。您可以这样使用:
{% load social_media_links_tags %} {% get_social_media_links as social_media_links %} {% if social_media_links %} <ul> {% for link in social_media_links %} <li><span class="symbol">{{ link.link_type.symbol|safe }}</span><a href="{{ link.url }}" title="{{ link.title }}">{{ link.name }}</a></li> {% endfor %} </ul> {% endif %}
或更短:
{% load social_media_links_tags %} {% get_social_media_links as social_media_links %} {% if social_media_links %} <ul> {% include "social_media_links/partials/link_list.html" with links=social_media_links %} </ul> {% endif %}
贡献
如果您想参与此项目,请执行以下步骤:
# Fork this repository # Clone your fork $ mkvirtualenv -p python2.7 django-social-media-links $ python setup.py install $ pip install -r dev_requirements.txt $ git co -b feature_branch master # Implement your feature and tests $ git add . && git commit $ git push -u origin feature_branch # Send us a pull request for your feature branch
许可证
此存储库利用 [单一社会因素](https://github.com/drinchev/monosocialiconsfont)所以 请看一下那个项目的许可证。