Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
update to django 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxMaSk committed Aug 5, 2018
1 parent d63006f commit c604556
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 28 deletions.
2 changes: 1 addition & 1 deletion django_th/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (1, 5, 2) # PEP 386
VERSION = (1, 6, 0) # PEP 386
__version__ = ".".join([str(x) for x in VERSION])

default_app_config = 'django_th.apps.DjangoThConfig'
2 changes: 2 additions & 0 deletions django_th/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,5 @@
TEST_RUNNER = 'django_th.runner.DiscoverRunnerTriggerHappy'
# Unit Test are buggy for this app ; so do not make them
TEST_RUNNER_WHITELIST = ('oauth2_provider', 'corsheaders')

LOGOUT_REDIRECT_URL = '/th/'
2 changes: 1 addition & 1 deletion django_th/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_to_datetime(self):
self.assertTrue(type(date), type(datetime))

def test_download_image(self):
url = 'https://foxmask.trigger-happy.eu/static/ouaf.jpg'
url = 'https://foxmask.net/static/ouaf.jpg'
local_filename = download_image(url)
self.assertTrue(type(str), local_filename)

Expand Down
8 changes: 2 additions & 6 deletions django_th/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import django.contrib.messages
from django.core.cache import caches
from django.shortcuts import reverse
from django.test import RequestFactory, Client
from django.test import RequestFactory

from django_th.models import TriggerService, UserService
from django_th.views import TriggerEditedTemplateView
Expand Down Expand Up @@ -98,10 +98,6 @@ def test_can_modify_trigger(self):
consumer='ServiceTwitter'))
# self.assertTrue(can_modify_trigger(request, consumer='', provider=''))

def test_logout(self):
c = Client()
c.logout()

def test_trigger_on_off(self):
t = self.create_triggerservice()
response = trigger_on_off(request=self.request, trigger_id=t.id)
Expand All @@ -114,7 +110,7 @@ def test_trigger_on_off(self):
def test_fire_trigger(self):
service = self.create_triggerservice()
name = 'TriggerHappy RSS'
url = 'https://blog.trigger-happy.eu/feeds/all.rss.xml'
url = 'https://foxmask.net/feeds/all.rss.xml'
status = True
Rss.objects.create(uuid=uuid.uuid4(), url=url, name=name,
trigger=service, status=status)
Expand Down
22 changes: 11 additions & 11 deletions django_th/urls.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.views import password_change, password_change_done
from django.contrib.auth import views as auth_views
from django.urls import path

from django_th.forms.wizard import DummyForm, ProviderForm, ConsumerForm, ServicesDescriptionForm

from django_th.views import TriggerListView, TriggerDeleteView, TriggerUpdateView, TriggerEditedTemplateView, MeUpdate
from django_th.views import TriggerDeletedTemplateView, me
from django_th.views_fbv import logout_view, trigger_switch_all_to, trigger_edit, trigger_on_off, fire_trigger
from django_th.views_fbv import trigger_switch_all_to, trigger_edit, trigger_on_off, fire_trigger
from django_th.views_fbv import service_related_triggers_switch_to

from django_th.views_userservices import UserServiceListView, UserServiceCreateView, UserServiceUpdateView
Expand All @@ -29,19 +29,19 @@
# ****************************************
path(r'me/', me, name='me'),
path(r'me/edit/', MeUpdate.as_view(), name='edit_me'),

# ****************************************
# auth module
# ****************************************
url(r'^auth/password_change/$', password_change,
{'template_name': 'auth/change_password.html'}),
url(r'^auth/password_change/done/$', password_change_done,
{'template_name': 'auth/password_change_done.html'}),

path(
'auth/password_change/',
auth_views.PasswordChangeView.as_view(template_name='auth/change_password.html'),
),
path(
'auth/password_change/done/',
auth_views.PasswordChangeDoneView.as_view(template_name='auth/password_change_done.html'),
),
path('auth/', include('django.contrib.auth.urls')),
# ****************************************
# customized logout action
# ****************************************
path('logout/', logout_view, name='logout'),

# ****************************************
# trigger happy module
Expand Down
9 changes: 0 additions & 9 deletions django_th/views_fbv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# django
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import logout
from django.core.cache import caches
from django.core import management
from django.http import HttpResponseRedirect
Expand All @@ -30,14 +29,6 @@ def can_modify_trigger(request, provider, consumer):
return True


def logout_view(request):
"""
logout the user then redirect him to the home page
"""
logout(request)
return HttpResponseRedirect(reverse('base'))


def trigger_on_off(request, trigger_id):
"""
enable/disable the status of the trigger then go back home
Expand Down
50 changes: 50 additions & 0 deletions docs/installation_guide/update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. _installation:

========
Updating
========


From GitHub
===========

.. code-block:: bash
git pull https://github.com/push-things/django-th.git
then continue by installing :

.. code-block:: bash
cd django-th
pip install -e .[all]
From Pypi
=========


.. code-block:: bash
pip install -U django-th
Database
========

update the database

.. code-block:: bash
python manage.py migrate
Start the application
=====================

.. code-block:: bash
python manage.py runserver &
Now open your browser and go to http://127.0.0.1:8000/th/ to start using the application by logged in

0 comments on commit c604556

Please sign in to comment.