def send_all_invitations(test_only, mark_as_sent, unopened):
    if unopened:
        print('resending emails to partys who did not open their invitation.')
        to_send_to = Party.in_default_order().filter(
            is_invited=True,
            invitation_opened=None).exclude(is_attending=False)
    else:
        to_send_to = Party.in_default_order().filter(
            is_invited=True, invitation_sent=None).exclude(is_attending=False)

    for party in to_send_to:
        send_invitation_email(party, test_only=test_only)
        if mark_as_sent:
            party.invitation_sent = timezone.now()
            party.save()
def send_all_invitations(test_only, mark_as_sent):
    to_send_to = Party.in_default_order().filter(is_invited=True, invitation_sent=None).exclude(is_attending=False)
    for party in to_send_to:
        send_invitation_email(party, test_only=test_only)
        if mark_as_sent:
            party.invitation_sent = datetime.now()
            party.save()
def send_all_save_the_dates(test_only=False, mark_as_sent=False):
    to_send_to = Party.in_default_order().filter(is_invited=True, save_the_date_sent=None)
    for party in to_send_to:
        send_save_the_date_to_party(party, test_only=test_only)
        if mark_as_sent:
            party.save_the_date_sent = datetime.now()
            party.save()
Esempio n. 4
0
def export_guests():
    headers = [
        'party_name', 'first_name', 'last_name', 'party_type',
        'is_child', 'category', 'is_invited', 'is_attending',
        'rehearsal_dinner', 'meal', 'email', 'comments'
    ]
    file = StringIO.StringIO()
    writer = csv.writer(file)
    writer.writerow(headers)
    for party in Party.in_default_order():
        for guest in party.guest_set.all():
            if guest.is_attending:
                writer.writerow([
                    party.name,
                    guest.first_name,
                    guest.last_name,
                    party.type,
                    guest.is_child,
                    party.category,
                    party.is_invited,
                    guest.is_attending,
                    party.rehearsal_dinner,
                    guest.meal,
                    guest.email,
                    party.comments,
                ])
    return file
def export_guests():
    headers = [
        'party_name', 'first_name', 'last_name', 'category', 'is_invited',
        'is_invited_to_church', 'is_attending', 'diet', 'email',
        'phone_number', 'whatsapp_inviter', 'comments'
    ]
    with open('asd.csv', mode='w') as file:
        writer = csv.writer(file)
        writer.writerow(headers)
        for party in Party.in_default_order():
            for guest in party.guest_set.all():
                # if guest.is_attending:
                writer.writerow([
                    party.name,
                    guest.first_name,
                    guest.last_name,
                    party.category,
                    party.is_invited,
                    party.is_invited_to_church,
                    guest.is_attending,
                    guest.diet,
                    guest.email,
                    guest.phone_number,
                    guest.whatsapp_inviter,
                    party.comments,
                ])
        return file
def export_guests():
    headers = [
        'party_name', 'first_name', 'last_name', 'plus_one', 'category',
        'is_child', 'email', 'mailing_address', 'is_attending',
        'plus_one_attending', 'comments'
    ]
    file = StringIO.StringIO()
    writer = csv.writer(file)
    writer.writerow(headers)
    for party in Party.in_default_order():
        for guest in party.guest_set.all():
            writer.writerow([
                party.name,
                guest.first_name,
                guest.last_name,
                guest.has_plus_one,
                party.category,
                guest.is_child,
                guest.email,
                guest.home_address,
                guest.is_attending,
                guest.plus_one_attending,
                party.comments,
            ])
    return file
Esempio n. 7
0
def create_qr_codes(output_dir):
    to_send_to = Party.in_default_order().filter(
        is_invited=True, invitation_sent=None).exclude(is_attending=False)
    table_data = str()
    for party in to_send_to:
        print("Creating QR for: {} - {}".format(party.name,
                                                party.invitation_id))
        rsvp_url = reverse('invitation', args=[party.invitation_id])
        rsvp_url = "https://{}{}".format(settings.BASE_URL, rsvp_url)
        print("URL: {}".format(rsvp_url))
        qr_img = gen_qr_code(rsvp_url)
        qr_img_path = "{}/img/{}.png".format(output_dir, party.invitation_id)
        qr_img_static = "img/{}.png".format(party.invitation_id)
        qr_img.save(qr_img_path)
        body_text = """
            If you have a smartphone or tablet please scan the code using your<br>
            camera app (use Lens from the Google Assistant for Samsung devices)<br>
            or navigate to the following link to submit your RSVP<br>
            {} <br>
            <br>
            If there are any issues or questions, please feel free to contact us directly at<br>
            Phone: 732-245-9653 <br>
            Email: [email protected] <br>
            Thank you! <br>
            Cliff & Melissa
            """.format(rsvp_url)
        table_entry = """
            <div>
            <table class="tg">
              <tr>
                <td class="tg-0lax" colspan="2">************************</td>
              </tr>
              <tr>
                <td class="tg-0lax" colspan="2">{}</td>
              </tr>
              <tr>
                <td class="tg-0lax"><img src="{}"></td>
                <td class="tg-0lax">{}</td>
              </tr>
            </table>
            </div>
            """.format(party.name, qr_img_static, body_text)
        table_data += "{}\n".format(table_entry)
    # Build full html page for printing
    table_text = """
        <table class="tg">
          {}
        </table>
        """.format(table_data)
    html_text = """
        <html>
        <head></head>
        <body>
          {}
        </body>
        </html>
        """.format(table_data)
    with open("{}/qr.html".format(output_dir), "w") as f:
        f.write(html_text)
Esempio n. 8
0
def send_all_save_the_dates(test_only=False, mark_as_sent=False):
    to_send_to = Party.in_default_order().filter(is_invited=True, save_the_date_sent=None)
    for party in to_send_to:
        successful = send_save_the_date_to_party(party, test_only=test_only)
        if mark_as_sent and successful:
            party.save_the_date_sent = timezone.now()
            party.save()
    print('all done!')
Esempio n. 9
0
def send_all_follow_ups(test_only, mark_as_sent):
    to_send_to = Party.in_default_order().filter(is_invited=True, is_attending=None, invitation_sent__isnull=False, follow_up_sent__isnull=True)\
        .exclude(responded_to_invitation__isnull=False)
    for party in to_send_to:
        send_follow_up_email(party, test_only=test_only)
        if mark_as_sent:
            party.follow_up_sent = timezone.now()
            party.save()
    print("All Done!")
def send_all_reminders(test_only, mark_as_sent):
    to_send_to = Party.in_default_order().filter(is_invited=True,
                                                 is_attending=True,
                                                 reminder_sent__isnull=True)
    for party in to_send_to:
        send_reminder_email(party, test_only=test_only)
        if mark_as_sent:
            party.reminder_sent = timezone.now()
            party.save()
    print("All Done!")
Esempio n. 11
0
def send_all_invitations(test_only, mark_as_sent, sender):

    to_send_to = Party.in_default_order().filter(
        is_invited=True, invitation_sent=None,
        guest__whatsapp_inviter=sender).exclude(is_attending=False)
    for party in to_send_to:
        succeeded = send_invitation_whatsapp(party)
        if mark_as_sent and succeeded:
            party.invitation_sent = datetime.now()
            party.save()
Esempio n. 12
0
def send_all_invitations(test_only, mark_as_sent):
    to_send_to = Party.in_default_order().filter(type='dimagi')
    sent_invites = []
    k = 0
    for party in tqdm.tqdm(to_send_to):
	print party.name
        send_invitation_email(party, test_only=test_only)
        if mark_as_sent:
            party.invitation_sent = datetime.now()
            party.save()
        sent_invites.append(party.name)
        time.sleep(10)
Esempio n. 13
0
def send_all_thank_you(test_only, mark_as_sent):
    not_attending = Q(is_attending=False)
    no_gift_received = Q(received_gifts__isnull=True) | Q(received_gifts='')
    to_send_to = Party.in_default_order().filter(
        is_invited=True,
        receives_a_thank_you_note=True,
        thank_you_sent__isnull=True).exclude(not_attending & no_gift_received)
    for party in to_send_to:
        send_thank_you_email(party, test_only=test_only)
        if mark_as_sent:
            party.thank_you_sent = timezone.now()
            party.save()
    print("All Done!")
Esempio n. 14
0
def export_guests():
    headers = [
        'party_name', 'first_name', 'last_name', 'is_child', 'is_invited',
        'is_attending', 'meal', 'email', 'comments'
    ]
    file = StringIO()
    writer = csv.writer(file)
    writer.writerow(headers)
    print('toot')
    for party in Party.in_default_order():
        print(party)
        for guest in party.guest_set.all():
            writer.writerow([
                party.name,
                guest.first_name,
                guest.last_name,
                guest.is_child,
                party.is_invited,
                guest.is_attending,
                guest.meal,
                guest.email,
                party.comments,
            ])
    return file