Skip to content

Commit 847f964

Browse files
code-review-doctorauvipy
authored andcommitted
Improve efficiency of ORM lookups
1 parent cfdd65b commit 847f964

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

push_notifications/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get_queryset(self):
5656

5757
class GCMDeviceQuerySet(models.query.QuerySet):
5858
def send_message(self, message, **kwargs):
59-
if self:
59+
if self.exists():
6060
from .gcm import send_message as gcm_send_message
6161

6262
data = kwargs.pop("extra", {})
@@ -121,7 +121,7 @@ def get_queryset(self):
121121

122122
class APNSDeviceQuerySet(models.query.QuerySet):
123123
def send_message(self, message, creds=None, **kwargs):
124-
if self:
124+
if self.exists():
125125
from .apns import apns_send_bulk_message
126126

127127
app_ids = self.filter(active=True).order_by("application_id")\

0 commit comments

Comments
 (0)