Add a check_apns_tokens manage.py command to flush old tokens

(imported from commit 15dcfaa1967bd749b582882c4a816a457ca6cc12)
This commit is contained in:
Leo Franchi 2013-10-23 13:39:57 -04:00
parent 410ee44eb6
commit dc8bfde0b4
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from django.conf import settings
from zerver.models import AppleDeviceToken
from zerver.lib.push_notifications import check_apns_feedback
import logging
class Command(BaseCommand):
help = """Checks the Apple Push Notifications Service for any tokens that have been
invalidated, and removes them from the database.
Usage: ./manage.py check_apns_tokens"""
def handle(self, *args, **options):
check_apns_feedback()