Slack invitation page for Django (like https://github.com/rauchg/slackin)
Install django-slackin-public
# pip install django-slackin-public
Add to your INSTALLED_APPS
INSTALLED_APPS = (
...
'django_slackin_public',
)
Include the django-slackin-public URLconf in your project urls.py like this
url(r'^slackin/', include('django_slackin_public.urls')),
Update your settings.py
SLACKIN_TOKEN = 'YOUR-SLACK-TOKEN' # create a token at https://api.slack.com/web
SLACKIN_SUBDOMAIN = 'your-team' # if https://your-team.slack.com
Visit http://localhost:8000/slackin/ to send an invite to your Slack team.
Use signals to listen for invite events. Available signals are:
- email_address_already_invited
- email_address_already_in_team
- sent_invite_to_email_address
To listen for a signal:
from slackin.signals import sent_invite_to_email_address
@receiver(sent_invite_to_email_address)
def my_invite_handler(sender, email_address):
print 'SIGNAL RECEIVED: {}'.format(email_address)
To use custom templates, add the either of following files to your app's template directory depending on what you want to customize. See templates/slackin for more details.
slackin/invite/page.html
: the surroundingbody
,head
, and inlined stylesslackin/invite/content.html
: the text and form
Templates have access to the following slackin-specific context variables:
slackin.team_name
: slack team nameslackin.team_image
: slack team imageslackin.users_online
: number of team members currently onlineslackin.users_total
: total number of team membersslackin_invite_form
: invite form objectslackin_invite_form_success
:True
ifslackin_invite_form.is_valid()
Using Dad
$ dad clone mtlpy/django-slackin-public
...
$ dad up
...
$ dad lint
...
- Change the version in
setup.py
- Commit with message like
Release vX.X.X
- Run
dad upload-release