squaresdb.membership.views module¶
Views for Tech Squares DB membership functionality
- class squaresdb.membership.views.BulkPersonAuthLinkCreationForm(*args, **kwargs)[source]¶
Bases:
FormForm to mail-merge out a bunch of PersonAuthLinks
Form fields:
reason: Reason (CharField)expire_in: Expire In (ChoiceField)subject: Subject (CharField)reply_to: Reply To (EmailField)template: Template (CharField)people: People (ModelMultipleChoiceField)
- 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¶
- class squaresdb.membership.views.ClassDetail(**kwargs)[source]¶
Bases:
PermissionRequiredMixin,DetailView- permission_required = ('membership.view_tsclass', 'membership.view_tsclassassist', 'membership.view_tsclassmember', 'membership.view_person')¶
- class squaresdb.membership.views.ClassList(**kwargs)[source]¶
Bases:
PermissionRequiredMixin,ListView- 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:
ModelFormForm fields:
label: Label (CharField)start_date: Start date (DateField)end_date: End date (DateField)coordinator: Coordinator (ModelChoiceField)student_csv: Student Csv (FileField)
- 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:
ModelFormForm to edit a Person
Form fields:
name: Name (CharField)email: Email (EmailField)confirm_email: Confirm Email (CharField)level: Highest level (ModelChoiceField)frequency: Attendance frequency (ModelChoiceField)mark_correct: Mark Correct (BooleanField)
- 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.
- squaresdb.membership.views.create_personauthlinks(request)[source]¶
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.
- squaresdb.membership.views.edit_person_personauthlink(request, secret)[source]¶
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.person_context_dict(person)[source]¶
Generate a context dict for substitution in a template string