forked from foxmask/django-th
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
FoxMaSk
committed
Jun 11, 2016
1 parent
c6d1c50
commit bff1440
Showing
20 changed files
with
693 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
Pushbullet | ||
========== | ||
|
||
Service Description: | ||
-------------------- | ||
|
||
Your devices working better together | ||
|
||
Nota : to be able to work, this service requires that your host uses HTTPS | ||
|
||
modifications of settings.py | ||
---------------------------- | ||
|
||
1) INSTALLED_APPS : | ||
|
||
.. code-block:: python | ||
INSTALLED_APPS = ( | ||
'th_pushbullet', | ||
) | ||
2) Cache : | ||
|
||
After the default cache add : | ||
|
||
.. code-block:: python | ||
CACHES = { | ||
'default': | ||
{ | ||
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', | ||
'LOCATION': BASE_DIR + '/cache/', | ||
'TIMEOUT': 600, | ||
'OPTIONS': { | ||
'MAX_ENTRIES': 1000 | ||
} | ||
}, | ||
# Pushbullet Cache | ||
'th_pushbullet': | ||
{ | ||
'TIMEOUT': 500, | ||
"BACKEND": "django_redis.cache.RedisCache", | ||
"LOCATION": "redis://127.0.0.1:6379/12", | ||
"OPTIONS": { | ||
"CLIENT_CLASS": "django_redis.client.DefaultClient", | ||
} | ||
}, | ||
3) TH_SERVICES | ||
add this line to the TH_SERVICES setting | ||
.. code-block:: python | ||
TH_SERVICES = ( | ||
'th_pushbullet.my_pushbullet.ServicePushbullet', | ||
) | ||
4) The service keys | ||
I strongly recommend that your put the following in a local_settings.py, to avoid to accidentally push this to a public repository | ||
.. code-block:: python | ||
TH_PUSHBULLET = { | ||
# get your credential by subscribing to | ||
# https://www.pushbullet.com/#settings/clients | ||
'client_id': '<your pushbulet id>', | ||
'client_secret': '<your pushbulet secret>', | ||
} | ||
creation of the table of the services | ||
------------------------------------- | ||
enter the following command | ||
.. code-block:: bash | ||
python manage.py migrate | ||
from the admin panel, activation of the service | ||
----------------------------------------------- | ||
from http://yourdomain.com/admin/django_th/servicesactivated/add/ | ||
* Select "Pushbullet", | ||
* Set the Status to "Enabled" | ||
* Check Auth Required: this will permit to redirect to the user (or you) to Twitter to ask to confirm the access to his/your Pushbullet account | ||
* Fill a description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ twython==3.4.0 | |
wallabag_api==1.1.0 | ||
flake8==2.5.4 | ||
todoist-python==7.0 | ||
pushbullet.py==0.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# coding: utf-8 | ||
|
||
from django import forms | ||
|
||
from django.forms import TextInput | ||
from th_pushbullet.models import Pushbullet | ||
|
||
PUSH_TYPE = (('note', 'Note'), ('link', 'Link'), ('file', 'File')) | ||
|
||
|
||
class PushbulletForm(forms.ModelForm): | ||
|
||
""" | ||
for to handle Todoist service | ||
""" | ||
type = forms.ChoiceField(widget=forms.Select( | ||
attrs={'class': 'form-control'})) | ||
|
||
class Meta: | ||
model = Pushbullet | ||
fields = ('type', 'device', 'email', 'channel_tag') | ||
widgets = { | ||
'device': TextInput(attrs={'class': 'form-control'}), | ||
'email': TextInput(attrs={'class': 'form-control'}), | ||
'channel_tag': TextInput(attrs={'class': 'form-control'}), | ||
} | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(PushbulletForm, self).__init__(*args, **kwargs) | ||
self.fields['type'].choices = PUSH_TYPE | ||
|
||
|
||
class PushbulletProviderForm(PushbulletForm): | ||
pass | ||
|
||
|
||
class PushbulletConsumerForm(PushbulletForm): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_th', '__first__'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Pushbullet', | ||
fields=[ | ||
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)), | ||
('name', models.CharField(max_length=255)), | ||
('type', models.CharField(max_length=4)), | ||
('device', models.CharField(max_length=80, blank=True)), | ||
('email', models.EmailField(max_length=255, blank=True)), | ||
('channel_tag', models.CharField(max_length=80, blank=True)), | ||
('status', models.BooleanField(default=False)), | ||
('description', models.CharField(max_length=255)), | ||
], | ||
options={ | ||
'db_table': 'django_th_pushbullet', | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name='pushbullet', | ||
name='trigger', | ||
field=models.ForeignKey(to='django_th.TriggerService'), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# coding: utf-8 | ||
from django.db import models | ||
from django_th.models.services import Services | ||
|
||
|
||
class Pushbullet(Services): | ||
|
||
""" | ||
todoist model to be adapted for the new service | ||
""" | ||
type = models.CharField(max_length=4, default='note') | ||
device = models.CharField(max_length=80, blank=True) | ||
email = models.EmailField(max_length=255, blank=True) | ||
channel_tag = models.CharField(max_length=80, blank=True) | ||
trigger = models.ForeignKey('TriggerService') | ||
|
||
class Meta: | ||
app_label = 'django_th' | ||
db_table = 'django_th_pushbullet' | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
def show(self): | ||
return "My Pushbullet %s" % self.name |
Oops, something went wrong.