squaresdb.membership.views module

Views for Tech Squares DB membership functionality

class squaresdb.membership.views.BulkPersonAuthLinkCreationForm(*args, **kwargs)[source]

Bases: Form

Form to mail-merge out a bunch of PersonAuthLinks

Form fields:

__init__(*args, **kwargs)[source]
default_template = 'Hi %(person_name)s,\n\nThe Tech Squares Membership DB is moving online. You can update (much of) your information at:\n\n    %(link)s\n\nThat page will also let you tell us that your information is correct -- until you do, we may continue to follow up with you, so we appreciate you visiting the page, even if your information is right already.\n\nYour current information is:\nName:                   %(person_name)s\nEmail:                  %(person_email)s\nHighest level:          %(person_level)s\nAttendance frequency:   %(person_frequency)s\n\nTo update the following information, please email squares-db-request@mit.edu:\nMembership status:  %(person_member_status)s\nMember since:       %(person_join_date)s\nMIT affiliation:    %(person_mit_affil)s\nMIT grad year:      %(person_grad_year)s\nFee category:       %(person_fee_cat)s\n\nThanks,\nTech Squares\n'
property media

Return all media required to render the widgets on this form.

people_qs = QuerySet
send_emails(request)[source]

Format and send the PersonAuthLink emails

class squaresdb.membership.views.ClassDetail(**kwargs)[source]

Bases: PermissionRequiredMixin, DetailView

get_context_data(*args, **kwargs)[source]

Insert the single object into the context dict.

model

alias of TSClass

permission_required = ('membership.view_tsclass', 'membership.view_tsclassassist', 'membership.view_tsclassmember', 'membership.view_person')
class squaresdb.membership.views.ClassList(**kwargs)[source]

Bases: PermissionRequiredMixin, ListView

get_context_data(*args, **kwargs)[source]

Get the context for this view.

model

alias of TSClass

permission_required = ('membership.view_tsclass',)
queryset = QuerySet
class squaresdb.membership.views.ImportClassForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Form fields:

property media

Return all media required to render the widgets on this form.

class squaresdb.membership.views.PersonForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

Form to edit a Person

Form fields:

clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

confirm_email_help = "If you are changing your email address, please enter it again to confirm that it is correct. Note that if you use an incorrect email address, you may unable to further update your information without contacting <a href='mailto:squares-db-request@mit.edu'>squares-db-request@mit.edu</a> for assistance."
contact_html = "<a href='mailto:squares-db-request@mit.edu'>squares-db-request@mit.edu</a>"
mark_correct_help = 'If your information is correct, please check this box so we know how recent the information is.'
property media

Return all media required to render the widgets on this form.

View to bulk create and mail merge out PersonAuthLinks

squaresdb.membership.views.edit_person_obj(request, person)[source]

Helper to edit a Person

The user calling the function is assumed to have permission to edit the Person passed – callers are responsible for identifying the correct Person and checking authz.

Edit a Person based on a PersonAuthLink

If a correct PersonAuthLink secret is provided, allow editing that Person. If a real but invalid (eg, expired or tampered with) PersonAuthLink is supplied, allow generating a replacement. Otherwise, report an error.

squaresdb.membership.views.edit_user_person(request, person_id=None)[source]

Edit a Person corresponding to the logged-in user

squaresdb.membership.views.format_date(date)[source]

Format a possible date for end users

squaresdb.membership.views.import_class(request)[source]

View to import members of a class

Generate HTML for mailto link to an address

squaresdb.membership.views.person_context_dict(person)[source]

Generate a context dict for substitution in a template string

Resend an expired or otherwise old PersonAuthLink

squaresdb.membership.views.view_person(request, pk)[source]

Simple view to display a person