"""This script looks up all clients for a merchant created within a datetime range and sends the activation e-mail"""fromdatetimeimportdatetimefrombulk.modelsimportBulkAccountdefclient_import_ordering_pricing_update(merchant_code,cutoff_date_start,cutoff_date_end=None):# All of the merchant's clients which excludes THE merchant clientclients_queryset=BulkAccount.objects.filter(effective_merchant__merchant_code=merchant_code,created__gte=cutoff_date_start,created__lte=cutoff_date_endordatetime.now(),bulk_merchant__isnull=True)forclientinclients_queryset:client.notifications.enqueue_bulk_acct_activate_message()# Example usage:my_merchant_code='BLOOMIN'my_cutoff_date_start=datetime(2018,7,26,1,0,0)my_cutoff_date_end=datetime(2018,8,29,23,59,59)client_import_ordering_pricing_update(my_merchant_code,my_cutoff_date_start,my_cutoff_date_end)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.