-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
134 lines (92 loc) · 3.43 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
django-sharer
=============
This is a simple Django application that provides an interface to share a
given item on social networking sites, or send an email to a friend about it.
Dependencies
------------
django-sharer requires Django 1.0 or later. To enable the JavaScript widget,
jQuery 1.2 or later with the jQuery Class plug-in
<http://github.com/taylanpince/jquery-class> is needed. A combined version of
these tools is available within the distribution, but if you already are using
jQuery in your project, you might want to grab the Class plug-in separately
and include it in your template.
Installation
------------
To install the app, make sure you place it somewhere on your PYTHONPATH and
include it in your INSTALLED_APPS in settings.py:
INSTALLED_APPS = (
...
'django-sharer',
...
)
You may also want to include the share_uri context processor in your
TEMPLATE_CONTEXT_PROCESSORS:
TEMPLATE_CONTEXT_PROCESSORS = (
...
'sharer.context_processors.share_uri',
)
This is not required, but makes it possible for the app to generate a widget
without any parameters.
If you are going to use the share by email feature, you should also update
your urls.py to include sharer urls:
(r'^share/', include('sharer.urls')),
In your MEDIA_ROOT folder, make a symlink named sharer to the django-sharer's
media directory:
cd my_project/media
ln -s path/to/django-sharer/sharer/media sharer
Finally, to use the widget in your templates, load the template tag library,
include the necessary JS and CSS files, and then call the template tag:
{% load sharer_tags %}
{% block javascript %}
<script type="text/javascript" src="{{ MEDIA_URL }}sharer/js/sharer.js"></script>
{% endblock %}
{% block css %}
<style type="text/css">
@import "{{ MEDIA_URL }}sharer/css/sharer.css";
</style>
{% endblock %}
{% block content %}
{% share %}
{% endblock %}
You can also call the share template tag with a specific title and/or URL:
{% share title url %}
Customization
-------------
If you would like to send out email messages that contain HTML instead of
plain text, you can do so by explicitly calling the email views with some
extra parameters. In your urls.py, instead of including sharer urls, do this:
url(r'^share/$', 'sharer.views.share', {
"mimetype": "html",
"subject_template": "sharer/subject.txt",
"body_template": "sharer/body.html",
}, name='sharer_share'),
url(r'^share/done/$', 'sharer.views.share_done', name='sharer_done'),
You can also turn off sharing by email completely by overriding the default
setting variable. In your settings.py, do this:
SHARER_ENABLE_EMAILS = False
If you set this to False, you don't have to include the urls.
Initial Data
------------
The app comes with an initial_data fixture that will be automatically loaded
when it's synchronized. Following networks are included with their icons and
URL schemes:
Yahoo! Bookmarks
Newsvine
LinkedIn
Windows Live
Google Bookmarks
Technorati
Reddit
StumbleUpon
Twitter
Delicious
Digg
Facebook
You can add/delete networks from the admin area.
Features to be Implemented
--------------------------
- Email sender should be secured against possible spammer attacks. Possible
solutions:
* CAPTCHA
* Check HTTP_REFERRER
- AJAX requests should show a loading bar