django-restit 4.2.101__py3-none-any.whl → 4.2.103__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/fcm/v1.py CHANGED
@@ -110,13 +110,13 @@ class FirebaseNotifier:
110
110
  message["notification"] = dict(title=title, body=body)
111
111
  if data:
112
112
  priority = kwargs.get("priority", None)
113
- message["data"] = data
114
- if priority == "high":
115
- message["android"] = dict(priority="high")
116
- message["apns"] = dict(headers={"apns-priority": "10"})
117
- else:
118
- message["android"] = dict(priority="normal")
119
- message["apns"] = dict(headers={"apns-priority": "5"})
113
+ message["data"] = {k:str(v) for k,v in data.items()}
114
+ # if priority == "high":
115
+ # message["android"] = dict(priority="high")
116
+ # message["apns"] = dict(headers={"apns-priority": "10"})
117
+ # else:
118
+ # message["android"] = dict(priority="normal")
119
+ # message["apns"] = dict(headers={"apns-priority": "5"})
120
120
  payload = dict(message=message)
121
121
  if DEBUG_FCM:
122
122
  logger.info("request", payload)
@@ -0,0 +1,18 @@
1
+ # Generated by Django 4.2.11 on 2024-06-18 17:05
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('account', '0021_alter_cloudcredentials_group'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name='memberdevice',
15
+ name='modified',
16
+ field=models.DateTimeField(auto_now=True, db_index=True),
17
+ ),
18
+ ]
account/models/device.py CHANGED
@@ -16,7 +16,7 @@ class MemberDevice(models.Model, rm.RestModel, rm.MetaDataModel):
16
16
  This can include mobile and desktop devices.
17
17
  """
18
18
  created = models.DateTimeField(auto_now_add=True)
19
- modified = models.DateTimeField(auto_now=True)
19
+ modified = models.DateTimeField(auto_now=True, db_index=True)
20
20
 
21
21
  member = models.ForeignKey("account.Member", related_name="devices", on_delete=models.CASCADE)
22
22
 
account/models/member.py CHANGED
@@ -628,9 +628,8 @@ class Member(User, RestModel, MetaDataModel):
628
628
  # slog.logout()
629
629
 
630
630
  def notifyMobile(self, data=None, title=None, body=None):
631
- for device in self.devices.filter(cm_provider="fcm", state=1):
632
- if device.cm_token is None:
633
- continue
631
+ stale = datetime.now() - timedelta(days=60)
632
+ for device in self.devices.filter(state=1, modified__gt=stale).exclude(cm_provider="ws", cm_token__isnull=True):
634
633
  if data is not None:
635
634
  device.sendData(data)
636
635
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.101
3
+ Version: 4.2.103
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -2,7 +2,7 @@ account/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  account/admin.py,sha256=8MQ1gAgjpPUC_SGCVMwd7I8fqLetqcutLiasjssEPRY,1839
3
3
  account/fcm/__init__.py,sha256=lXuz5z0bL5TXqVdaXxiVr-4zF_Q1IZ8kPEkuYGb5eB0,17
4
4
  account/fcm/legacy.py,sha256=5WM5HAnjVPweT0oe3rBN9tBGHfC-DPa-e9luH3baT8Y,959
5
- account/fcm/v1.py,sha256=dHoa7vBv-VAqP41DisJgFzvaYsCYmXpqBxftcfUAox8,4339
5
+ account/fcm/v1.py,sha256=BTM8T-3fsSm6QrmnDUW94_zl6FIZw1a2Ky2T799JHk8,4381
6
6
  account/migrations/0001_initial.py,sha256=PhYNDTiwjyUplErBmYc34ecynLIEJL2JuC02o8GCXes,15894
7
7
  account/migrations/0003_member_phone_number.py,sha256=auAJCfxsK-y3Veo0vwZfrIZxvwHYBjg5CpYRgCWghCQ,738
8
8
  account/migrations/0004_group_modified_alter_group_created.py,sha256=20iNFlUGtRCWUsxEqTJFRQKQ73z4REhfo-hGam8IHXY,551
@@ -23,13 +23,14 @@ account/migrations/0018_userpasskey.py,sha256=SdXYo4TkIeP5wLNfCza3Jq5-gKuUufzTHG
23
23
  account/migrations/0019_group_location.py,sha256=EfMB_w4qWUGDqQeNc453PFZwpjpTeoA6xr6Qgo_YAOM,601
24
24
  account/migrations/0020_cloudcredentials_cloudcredentialsmetadata.py,sha256=mHwxkyDfA4ueQOt34w5ndJB4XwNTDLv79CkKgzhlz-c,2250
25
25
  account/migrations/0021_alter_cloudcredentials_group.py,sha256=zoFYmE-hd3uRGX6DRO9k-osPwH0jFeTU7S-pjCOtakk,561
26
+ account/migrations/0022_alter_memberdevice_modified.py,sha256=9eeKcdr9p6qFJ8ZxSnKSj1KxZjW8NZfM0YCMck6i0QQ,424
26
27
  account/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
28
  account/models/__init__.py,sha256=cV_lMnT2vL_mjiYtT4hlcIHo52ocFbGSNVkOIHHLXZY,385
28
- account/models/device.py,sha256=DDeYCX_6gNgSIvfkPaICtxVilZXcjZNSNDQNikGA9lc,5871
29
+ account/models/device.py,sha256=qW9tKMFhlSepaNku4OOHGb9VoSU6hhOXyg4hzDwlbKk,5886
29
30
  account/models/feeds.py,sha256=vI7fG4ASY1M0Zjke24RdnfDcuWeATl_yR_25jPmT64g,2011
30
31
  account/models/group.py,sha256=mjWwePt3ogQUo9m0EhURMz0aBrVVx_0Drr0lNDESQio,22281
31
32
  account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
32
- account/models/member.py,sha256=8xi-NahJipic_ut81vCFG-hY9x1U-trZ9KhnhIHAaFM,53092
33
+ account/models/member.py,sha256=XYb3LUd9HhhY6fX4m963-ts0VTmYLLjiqpPzlMoF7Xo,53129
33
34
  account/models/membership.py,sha256=90EpAhOsGaqphDAkONP6j_qQ0OWSRaQsI8H7E7fgMkE,9249
34
35
  account/models/notify.py,sha256=TOkuVBLAsbzT58FOxII_G3Cj_IDQx16vyehyEsNrDcY,15306
35
36
  account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
@@ -507,7 +508,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
507
508
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
508
509
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
509
510
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
510
- django_restit-4.2.101.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
511
- django_restit-4.2.101.dist-info/METADATA,sha256=8k0GzJ6-pWg5Cjzo8JkcK7mHswnujmGX5zPpDaSjS58,7663
512
- django_restit-4.2.101.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
513
- django_restit-4.2.101.dist-info/RECORD,,
511
+ django_restit-4.2.103.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
512
+ django_restit-4.2.103.dist-info/METADATA,sha256=nrU8OENjEKfiHoufi6H03kYhsf4mkpD01W8WvOWJkeM,7663
513
+ django_restit-4.2.103.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
514
+ django_restit-4.2.103.dist-info/RECORD,,