Skip to content

Commit

Permalink
feat: signals
Browse files Browse the repository at this point in the history
Добавлен сигнал который вызывается когда приходит сообщение на call_back
  • Loading branch information
iredun committed Jan 19, 2021
1 parent dabf6f3 commit 184dca9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions smsru/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'smsru.apps.SmsruConfig'
5 changes: 5 additions & 0 deletions smsru/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import django.dispatch

smsru_call_back_sms = django.dispatch.Signal(
providing_args=["instance", "new_status"],
)
2 changes: 2 additions & 0 deletions smsru/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from smsru.models import Log
from smsru.service import SmsRuApi
from smsru.signals import smsru_call_back_sms


@csrf_exempt
Expand All @@ -17,4 +18,5 @@ def sms_callback(request):
if item:
item.status_code = data_item[2]
item.save()
smsru_call_back_sms.send(item.__class__, instance=item, new_status=item.status_code)
return HttpResponse(100)

0 comments on commit 184dca9

Please sign in to comment.