Emails

This module is used to manage LNL’s email communications.

Models

class emails.models.MeetingNoticeMail(*args, **kwargs)[source]

Meeting Notice Email

Parameters:
  • id (AutoField) – Id (required)
  • ts (DateTimeField) – Ts (required)
  • place (CharField) – Place (default=AK219)
  • time (TimeField) – Time (default=17:00)
  • date (DateField) – Date (required)
  • note (TextField) – Note (required)
  • start_param (DateField) – Start param (required)
  • end_param (DateField) – End param (required)
  • sent (BooleanField) – Sent (default=False)
exception DoesNotExist
exception MultipleObjectsReturned
date

DateField()

end_param

DateField()

get_next_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=True, **kwargs)
get_next_by_end_param(*, field=<django.db.models.fields.DateField: end_param>, is_next=True, **kwargs)
get_next_by_start_param(*, field=<django.db.models.fields.DateField: start_param>, is_next=True, **kwargs)
get_next_by_ts(*, field=<django.db.models.fields.DateTimeField: ts>, is_next=True, **kwargs)
get_previous_by_date(*, field=<django.db.models.fields.DateField: date>, is_next=False, **kwargs)
get_previous_by_end_param(*, field=<django.db.models.fields.DateField: end_param>, is_next=False, **kwargs)
get_previous_by_start_param(*, field=<django.db.models.fields.DateField: start_param>, is_next=False, **kwargs)
get_previous_by_ts(*, field=<django.db.models.fields.DateTimeField: ts>, is_next=False, **kwargs)
id

AutoField(verbose_name=”ID”, primary_key=True, serialize=False, auto_created=True)

note

TextField()

objects = <django.db.models.manager.Manager object>
place

CharField(max_length=32, default=”AK219”)

sent

BooleanField(default=False)

start_param

DateField()

time

TimeField(default=”17:00”)

ts

DateTimeField(auto_now_add=True)

class emails.models.SMSMessage(*args, **kwargs)[source]

SMS Text Message

Parameters:
  • id (AutoField) – Id (required)
  • user (ForeignKey to User) – User (required)
  • message (TextField) – Message (required)
exception DoesNotExist
exception MultipleObjectsReturned
id

AutoField(verbose_name=”ID”, primary_key=True, serialize=False, auto_created=True)

message

TextField()

objects = <django.db.models.manager.Manager object>
user

ForeignKey(on_delete=CASCADE(), to= User)

user_id

Raw (integer) FK for user


Views

class emails.views.MeetingAnnounceCCView(**kwargs)[source]
model

alias of meetings.models.CCNoticeSend

slug_field = 'uuid'
template_name = 'emails/email_notice_cc.html'
class emails.views.MeetingAnnounceView(**kwargs)[source]
model

alias of meetings.models.MeetingAnnounce

slug_field = 'uuid'
template_name = 'emails/email_notice.html'
emails.views.dispatch_console(request)[source]

Menu for email tools

emails.views.mk_srv_announce(request)[source]

Send out a web service announcement

emails.views.poke_cc(request)[source]

Send a “Poke for CC” email (searching for crew chiefs)

emails.views.send_active_sms(request)[source]

Send a text message to all active members (must have opted-in to receive text messages)

emails.views.send_sms(request)[source]

Send a text message to a specific user (must have opted-in to receive messages)


Generators

class emails.generators.BasicEmailGenerator(to_emails='lnl@wpi.edu', from_email='WPI Lens and Lights <lnl-no-reply@wpi.edu>', reply_to=None, bcc=None, context=None, template_basename='emails/email_basic', body=None)[source]

Non-HTML email with no LNL branding or formatting. Uses no-reply address by default.

send()[source]
class emails.generators.BillingEmailGenerator(event=None, subject='Invoice for LNL Services', to_emails='lnl@wpi.edu', cc=None, bcc=['lnl-t@wpi.edu'], from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=['lnl-t@wpi.edu'], context=None, template_basename='emails/email_billing', build_html=True, body=None, attachments=None)[source]
class emails.generators.CcAddEmailGenerator(ccinstance=None, subject='Crew Chief Add Notification', to_emails=None, cc=None, bcc=None, from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=None, context=None, template_basename='emails/email_ccadd', build_html=True, attachments=None)[source]
class emails.generators.DefaultLNLEmailGenerator(subject='LNL Notice', to_emails='lnl@wpi.edu', cc=None, bcc=None, from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=None, context=None, template_basename='emails/email_generic', build_html=True, body=None, attachments=None)[source]
send()[source]
class emails.generators.EventEmailGenerator(event=None, subject='LNL Event', to_emails='lnl@wpi.edu', cc=None, bcc=None, from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=None, context=None, template_basename='emails/email_event', build_html=True, body=None, attachments=None)[source]
class emails.generators.GenericEmailGenerator(subject=None, to_emails='lnl@wpi.edu', cc=None, bcc=None, from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=None, context=None, build_html=True, body=None, attachments=None)[source]
class emails.generators.ReportReminderEmailGenerator(reminder=None, subject='LNL Crew Chief Report Reminder Email', to_emails=None, cc=None, bcc=None, from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=None, context=None, template_basename='emails/email_reportreminder', build_html=True, attachments=None)[source]
class emails.generators.SurveyEmailGenerator(event=None, subject='Post-event survey for your recent event', to_emails='lnl@wpi.edu', cc=None, bcc=['lnl-vp@wpi.edu'], from_email='WPI Lens and Lights <lnl@wpi.edu>', reply_to=None, context=None, template_basename='emails/email_survey', build_html=True, attachments=None)[source]
emails.generators.generate_event_start_end_emails()[source]

Send an email for events starting or ending now

emails.generators.generate_notice_cc_email(notice)[source]

Generate a meeting notice email

Parameters:notice – A MeetingNoticeMail object
Returns:An email object
emails.generators.generate_notice_email(notice)[source]

Generate a meeting notice email

Parameters:notice – A MeetingNoticeMail object
Returns:An email object
emails.generators.generate_poke_cc_email_content(services, message)[source]

Generate the body of a “Poke for CC” email notification

Parameters:
  • services – An array or queryset of services crew chiefs are needed for
  • message – Additional message to display above the event details (Optional, but highly recommended)
Returns:

HTML formatted string

emails.generators.generate_selfservice_notice_email(context)[source]

Generate an email notification when a new client submits a self-service request

Parameters:context – Self-service form data
Returns:An email object
emails.generators.generate_sms_email(data)[source]

Generate a plain SMS text message for delivery via email

Parameters:data – A dictionary - {‘message’: <str>, ‘user’: <User>}
Returns:A basic (non-HTML) email object
emails.generators.generate_transfer_email(orgtransfer)[source]

Generate an organization transfer email notification

Parameters:orgtransfer – An OrganizationTransfer object
Returns:An email object
emails.generators.generate_web_service_email(details)[source]

Generate a generic email message with the Webmaster listed as the reply address

Parameters:details – A dictionary - {‘subject’: <str>, ‘message’: <str>, ‘email_to’: <str>}
Returns:A generic LNL email object
emails.generators.send_survey_if_necessary(event)[source]

Check to see if a post-event survey should be sent for a particular event. If so, send an email to the client.

Parameters:event – The event