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 16285c13f3 Support 202010 (#868)
* Add migrations for 463_745_775

* Black format the migration

* Bump up django_peeringdb version

* api require django-peeringdb 2.3.0.1 and later

* Set timezone to utc throughout sponsorship notifications

* Add government net type to existing migrtion

* Remove ixlan from peers at this exchange point

* Add new migration

* add backward migrtion

* Search on user__username not user object

* Black those changes

* Fix local erro bug

* Add test and fix speed update for deleted netixlan

* Handle attribute error

* Change language in email to reflect we don't email after x days

* Comment out EnvironmentSetting in django admin

* Disable the followup ticket and modify tests to correct deskproticket assertions

* exclude ixf tickets from deskpro publishing

* Add failing mock deskpro api and write a test with it

* Add anchor tags to notify-ixf-add

* a tags for conflict insert

* a tags for consolidated

* a tags modify

* a tags protocol conflict

* a tags remote changes

* a tags for remove

* a tags for resolved

* a tags source error

* Add target blank

* Add comment

* fix unhandled deskpro api errors

* Add mail attachment

* Remove strip_tags

* readd some strip_tags

* add explicit order for fields in admin control panel #861

* revert pretty_speed change

* Coerce is_rs_peer and operational to bool

* black formatted

* pipfile relock

Co-authored-by: Elliot Frank <elliot@20c.com>
Co-authored-by: Stefan Pratter <stefan@20c.com>
2020-11-03 18:26:15 -06:00

23 lines
839 B
Python

from django.core.management.base import BaseCommand
from peeringdb_server.models import Sponsorship
import datetime
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
):
b = sponsorship.notify_expiration()
# if b:
# self.log("Sent expiration notices for %s, expired on %s" % (sponsorship.org.name, sponsorship.end_date))