django-restit 4.2.103__py3-none-any.whl → 4.2.104__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- account/models/device.py +4 -2
- account/models/member.py +26 -1
- {django_restit-4.2.103.dist-info → django_restit-4.2.104.dist-info}/METADATA +1 -1
- {django_restit-4.2.103.dist-info → django_restit-4.2.104.dist-info}/RECORD +7 -7
- taskqueue/models.py +1 -1
- {django_restit-4.2.103.dist-info → django_restit-4.2.104.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.103.dist-info → django_restit-4.2.104.dist-info}/WHEEL +0 -0
account/models/device.py
CHANGED
@@ -41,13 +41,15 @@ class MemberDevice(models.Model, rm.RestModel, rm.MetaDataModel):
|
|
41
41
|
def sendData(self, message, **kwargs):
|
42
42
|
messenger = getCloudMessenger(self.cm_provider)
|
43
43
|
if messenger:
|
44
|
-
|
44
|
+
resp = messenger.sendToDevice(self, message)
|
45
|
+
return resp
|
45
46
|
return objict(status_code=404, reason=self.cm_provider)
|
46
47
|
|
47
48
|
def sendNotification(self, title, body):
|
48
49
|
messenger = getCloudMessenger(self.cm_provider)
|
49
50
|
if messenger:
|
50
|
-
|
51
|
+
resp = messenger.sendNotification(self.cm_token, title, body)
|
52
|
+
return resp
|
51
53
|
return objict(status_code=404, reason=self.cm_provider)
|
52
54
|
|
53
55
|
def notify(self, title, body):
|
account/models/member.py
CHANGED
@@ -627,7 +627,22 @@ class Member(User, RestModel, MetaDataModel):
|
|
627
627
|
# for slog in qset:
|
628
628
|
# slog.logout()
|
629
629
|
|
630
|
-
def notifyMobile(self, data=None, title=None, body=None):
|
630
|
+
def notifyMobile(self, data=None, title=None, body=None, delay=None):
|
631
|
+
if delay:
|
632
|
+
Task = RestModel.getModel("taskqueue", "Task")
|
633
|
+
if delay < 60:
|
634
|
+
Task.Publish(
|
635
|
+
"account.Member", "on_task_cm",
|
636
|
+
data=dict(pk=self.pk, delay=delay, data=data, title=title, body=body),
|
637
|
+
stale_after_seconds=300,
|
638
|
+
channel="tq_app_handler")
|
639
|
+
else:
|
640
|
+
Task.Publish(
|
641
|
+
"account.Member", "on_task_cm",
|
642
|
+
data=dict(pk=self.pk, data=data, title=title, body=body),
|
643
|
+
scheduled_for=datetime.now() + timedelta(seconds=delay),
|
644
|
+
channel="tq_app_handler")
|
645
|
+
return
|
631
646
|
stale = datetime.now() - timedelta(days=60)
|
632
647
|
for device in self.devices.filter(state=1, modified__gt=stale).exclude(cm_provider="ws", cm_token__isnull=True):
|
633
648
|
if data is not None:
|
@@ -1226,6 +1241,16 @@ class Member(User, RestModel, MetaDataModel):
|
|
1226
1241
|
return None
|
1227
1242
|
return cls.objects.filter(pk=uid).last()
|
1228
1243
|
|
1244
|
+
@classmethod
|
1245
|
+
def on_task_cm(cls, task):
|
1246
|
+
member = cls.objects.filter(pk=task.data.pk).last()
|
1247
|
+
if not member:
|
1248
|
+
task.failed("could not find member")
|
1249
|
+
return False
|
1250
|
+
if task.data.delay:
|
1251
|
+
time.sleep(task.data.delay) # delay
|
1252
|
+
member.notifyMobile(data=task.data.data, title=task.data.title, body=task.data.body)
|
1253
|
+
|
1229
1254
|
|
1230
1255
|
class MemberMetaData(MetaDataBase):
|
1231
1256
|
parent = models.ForeignKey(Member, related_name="properties", on_delete=models.CASCADE)
|
@@ -26,11 +26,11 @@ account/migrations/0021_alter_cloudcredentials_group.py,sha256=zoFYmE-hd3uRGX6DR
|
|
26
26
|
account/migrations/0022_alter_memberdevice_modified.py,sha256=9eeKcdr9p6qFJ8ZxSnKSj1KxZjW8NZfM0YCMck6i0QQ,424
|
27
27
|
account/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
28
|
account/models/__init__.py,sha256=cV_lMnT2vL_mjiYtT4hlcIHo52ocFbGSNVkOIHHLXZY,385
|
29
|
-
account/models/device.py,sha256=
|
29
|
+
account/models/device.py,sha256=0AFeLMGk4im4KZVd3eGSyRbK4eQEXiFM2cdY8GUzihs,5934
|
30
30
|
account/models/feeds.py,sha256=vI7fG4ASY1M0Zjke24RdnfDcuWeATl_yR_25jPmT64g,2011
|
31
31
|
account/models/group.py,sha256=mjWwePt3ogQUo9m0EhURMz0aBrVVx_0Drr0lNDESQio,22281
|
32
32
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
33
|
-
account/models/member.py,sha256=
|
33
|
+
account/models/member.py,sha256=JziyYNC13SFWX07Thtoe2V_YlrKNn2RHJZcRk15Zh-s,54205
|
34
34
|
account/models/membership.py,sha256=90EpAhOsGaqphDAkONP6j_qQ0OWSRaQsI8H7E7fgMkE,9249
|
35
35
|
account/models/notify.py,sha256=TOkuVBLAsbzT58FOxII_G3Cj_IDQx16vyehyEsNrDcY,15306
|
36
36
|
account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
|
@@ -455,7 +455,7 @@ taskqueue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
455
455
|
taskqueue/admin.py,sha256=E6zXoToS_ea3MdoGjZzF1JiepWFtDSoZUQdan8H-pXI,208
|
456
456
|
taskqueue/migrations/0001_initial.py,sha256=JwYib8CK5ftSXlfxKZUcKEEVsXktNB5q3h-2tu9inGk,4738
|
457
457
|
taskqueue/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
458
|
-
taskqueue/models.py,sha256=
|
458
|
+
taskqueue/models.py,sha256=i8v0vQqlz4X3rVFVJsUSldA-26NEPWnsMZF2Kly_1Qo,22398
|
459
459
|
taskqueue/periodic.py,sha256=2i0271khrCow3hDmlNEcoAZnesBVl40jd7MIim2Cxs4,3543
|
460
460
|
taskqueue/rpc.py,sha256=Lf5VUoqCRkfWUAIvx_s508mjAtDPwpiWyxg0ryqWbQA,5793
|
461
461
|
taskqueue/tq.py,sha256=PzSoDrawYcqZylruEgsK95gcJ4J_VhdM6rxg9V6_X8E,942
|
@@ -508,7 +508,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
508
508
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
509
509
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
510
510
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
511
|
-
django_restit-4.2.
|
512
|
-
django_restit-4.2.
|
513
|
-
django_restit-4.2.
|
514
|
-
django_restit-4.2.
|
511
|
+
django_restit-4.2.104.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
512
|
+
django_restit-4.2.104.dist-info/METADATA,sha256=HsONd8WhUPc5fhviH3GzFFyW0mu-LUo17xAdeFDtrRQ,7663
|
513
|
+
django_restit-4.2.104.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
514
|
+
django_restit-4.2.104.dist-info/RECORD,,
|
taskqueue/models.py
CHANGED
@@ -392,7 +392,7 @@ class Task(models.Model, RestModel):
|
|
392
392
|
return task
|
393
393
|
|
394
394
|
@classmethod
|
395
|
-
def PublishModelTask(cls, model_name, fname, data, stale_after_seconds=0, channel="tq_model_handler", scheduled_for=
|
395
|
+
def PublishModelTask(cls, model_name, fname, data, stale_after_seconds=0, channel="tq_model_handler", scheduled_for=None):
|
396
396
|
return cls.Publish(cls, model_name, fname, data, stale_after_seconds, channel, scheduled_for)
|
397
397
|
|
398
398
|
@classmethod
|
File without changes
|
File without changes
|