1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00
Files
peeringdb-peeringdb/peeringdb_server/management/commands/pdb_sponsorship_notify.py
Matt Griswold 77282c4b66 Prep 2.29 (#1024)
* django3, py39, lgtm, linting (#715)

* IX-F Importer: ticket status change when posting re-occuring conflict to existing resolved ticket (#920)

* fix recaptcha requirement for user creation in django-admin (#715)

* IX-F Importer: fix command output buffering #967

* Drop dot1q_support field #903

* fix test (#967)

* Add name, city, country to ixfac (GET operation) #166

* additional tests fir #166

* Allow IXP to trigger ix-f importer for their exchange #779

* add docker compose for dev

* add selinux labels for mountpoints

* fixes #1013: The process to permanently remove old soft-deleted network contacts pdb_delete_pocs raises a false ProtectedAction

* fix api test

* relock poetry

* remove django_namespace_perms from installed apps

* fix user permissios ui

* remove remaining references to django namespace perms

* linting

* copy tox.ini

* comment flake8 check until we figure out why it ignores configs from tox.ini

* black format

* poetry lock

Co-authored-by: Stefan Pratter <stefan@20c.com>
2021-08-18 08:21:22 -05:00

25 lines
837 B
Python

import datetime
from django.core.management.base import BaseCommand
from peeringdb_server.models import Sponsorship
class Command(BaseCommand):
help = "Looks for expired sponsorships and sends a notification to sponsorship admin for recently expired sponsorships"
def log(self, msg):
print(msg)
def handle(self, *args, **options):
now = datetime.datetime.now(tz=datetime.timezone.utc)
for sponsorship in Sponsorship.objects.filter(end_date__lt=now):
if (
sponsorship.notify_date is None
or sponsorship.notify_date < sponsorship.end_date
):
sponsorship.notify_expiration()
# if b:
# self.log("Sent expiration notices for %s, expired on %s" % (sponsorship.org.name, sponsorship.end_date))