def send_alert(organisation):
    FFAdminUser.send_alert_to_admin_users(
        subject='Organisation over number of seats',
        message=
        'Organisation %s has used %d seats which is over their plan limit of %d '
        '(plan: %s)' %
        (str(organisation.name), organisation.num_seats,
         organisation.subscription.max_seats, organisation.subscription.plan))
Beispiel #2
0
def send_alert_if_cancelled(sender, instance, *args, **kwargs):
    try:
        existing_object = sender.objects.get(pk=instance.pk)
    except sender.DoesNotExist:
        return

    if instance.cancellation_date and existing_object.cancellation_date != instance.cancellation_date:
        FFAdminUser.send_alert_to_admin_users(
            subject='Organisation %s has cancelled their subscription' % instance.organisation.name,
            message='Organisation %s has cancelled their subscription on %s' % (instance.organisation.name,
                                                                                datetime.strftime(
                                                                                    instance.cancellation_date,
                                                                                    '%Y-%m-%d %H:%M'))
        )
Beispiel #3
0
 def create_ffadminuser():
     Helper.clean_up()
     user = FFAdminUser(username="******", email="*****@*****.**",
                        first_name="test", last_name="user")
     user.set_password("testuser123")
     user.save()
     return user
Beispiel #4
0
 def create_ffadminuser():
     Helper.clean_up()
     organisation = Organisation(name='test org')
     organisation.save()
     project = Project(name="test project", organisation=organisation)
     project.save()
     environment = Environment(name="test env", project=project)
     environment.save()
     user = FFAdminUser(username="******",
                        email="*****@*****.**",
                        first_name="test",
                        last_name="user")
     user.set_password("testuser123")
     user.save()
     user.organisations.add(organisation)
     user.save()
     return user