Pages
This module makes it possible to quickly create new webpages using the Django admin site. You can create custom pages which utilize our static site’s stylesheets as well as simple onboarding screens which can be displayed immediately after a user logs in. This is also where you’ll find the source code for our main onboarding processes for new members.
Models
- class pages.models.CarouselImg(*args, **kwargs)[source]
Image to be displayed as part of a carousel on a custom page
- Parameters:
id (AutoField) – Id (required)
internal_name (CharField) – Internal name (required)
img (ImageField) – Img (required)
href (ForeignKey to
Page) – Hrefcaption_title (CharField) – Caption title
caption_desc (CharField) – Caption desc
- exception DoesNotExist
- exception MultipleObjectsReturned
- caption_desc
CharField(max_length=128, blank=True, null=True)
- caption_title
CharField(max_length=64, blank=True, null=True)
- id
AutoField(verbose_name=”ID”, primary_key=True, serialize=False, auto_created=True)
- img
FileField(upload_to=”carousel”)
- internal_name
CharField(max_length=64)
- objects = <django.db.models.manager.Manager object>
- class pages.models.OnboardingRecord(*args, **kwargs)[source]
Log of onboarding pages that have been displayed to a user
- Parameters:
id (AutoField) – Id (required)
user (ForeignKey to
User) – User (required)screens (ManyToManyField to
OnboardingScreen) – Screens (required)
- exception DoesNotExist
- exception MultipleObjectsReturned
- id
AutoField(verbose_name=”ID”, primary_key=True, serialize=False, auto_created=True)
- objects = <django.db.models.manager.Manager object>
- class pages.models.OnboardingScreen(*args, **kwargs)[source]
Custom page to display to users after they log in. Can be assigned to individual users or groups.
- Parameters:
id (AutoField) – Id (required)
title (CharField) – Title (required)
slug (SlugField) – Slug (required)
icon (CharField) – Icon or image HTML
content (TextField) – Content (required)
inverted (BooleanField) – Dark theme (default=False)
action_title (CharField) – If left blank this button will not be displayed
action_href (URLField) – URL to go to when clicked. If not supplied button will not be displayed.
action_color (CharField) – Action button - color
new_window (BooleanField) – Action button - open in new window (default=False)
next_btn (CharField) – Defaults to “Next”
users (ManyToManyField to
User) – Select users to display this to (required)groups (ManyToManyField to
Group) – Select groups of users to display this to. (required)
- exception DoesNotExist
- exception MultipleObjectsReturned
- action_color
CharField(verbose_name=”Action Button - Color”, max_length=16, blank=True, null=True)
- action_href
CharField(verbose_name=”Action Button - href”, max_length=128, blank=True, null=True, help_text=”URL to go to when clicked. If not supplied button will not be displayed.”)
Action button - href: URL to go to when clicked. If not supplied button will not be displayed.
- action_title
CharField(verbose_name=”Action Button - Text”, max_length=32, blank=True, null=True, help_text=”If left blank this button will not be displayed”)
Action button - text: If left blank this button will not be displayed
- content
TextField()
- icon
CharField(max_length=300, blank=True, null=True, help_text=”Icon or image HTML”)
Icon: Icon or image HTML
- id
AutoField(verbose_name=”ID”, primary_key=True, serialize=False, auto_created=True)
- inverted
BooleanField(verbose_name=”Dark Theme”, default=False)
- new_window
BooleanField(verbose_name=”Action Button - Open in New Window”, default=False)
- next_btn
CharField(verbose_name=”Next Button - Text”, max_length=32, blank=True, null=True, help_text=”Defaults to “Next””)
Next button - text: Defaults to “Next”
- objects = <django.db.models.manager.Manager object>
- slug
SlugField(max_length=64)
- title
CharField(max_length=64)
- class pages.models.Page(*args, **kwargs)[source]
Custom dynamic page using the static site stylesheets
- Parameters:
id (AutoField) – Id (required)
title (CharField) – Title (required)
slug (SlugField) – Slug (required)
description (TextField) – This page description may appear in search engine results and along with any links to this page. (required)
body (TextField) – Accepts raw text and/or HTML input (required)
body_in_jumbo (BooleanField) – Body in jumbo (default=False)
noindex (BooleanField) – Hide from search engines (default=False)
sitemap (BooleanField) – Include in sitemap (default=False)
sitemap_category (CharField) – Sitemap category
css (TextField) – Css (required)
imgs (ManyToManyField to
CarouselImg) – Imgs (required)
- exception DoesNotExist
- exception MultipleObjectsReturned
- body
TextField(help_text=”Accepts raw text and/or HTML input”)
Body: Accepts raw text and/or HTML input
- body_in_jumbo
BooleanField(default=False)
- css
TextField(verbose_name=”CSS”, blank=True)
- description
TextField(blank=True, help_text=”This page description may appear in search engine results and along with any links to this page.”)
Description: This page description may appear in search engine results and along with any links to this page.
- id
AutoField(verbose_name=”ID”, primary_key=True, serialize=False, auto_created=True)
- noindex
BooleanField(verbose_name=”Hide from search engines”, default=False)
- objects = <django.db.models.manager.Manager object>
- sitemap
BooleanField(verbose_name=”Include in Sitemap”, default=False)
- sitemap_category
CharField(max_length=32, blank=True, null=True)
- slug
SlugField(max_length=64)
- title
CharField(max_length=64)
Views
- class pages.views.OnboardingWizard(**kwargs)[source]
Onboarding wizard which helps guide new LNL members through setting up their accounts
- done(form_list, **kwargs)[source]
This method must be overridden by a subclass to process to form data after processing all steps.
- form_list = [<class 'pages.forms.OnboardingUserInfoForm'>, <class 'pages.forms.OnboardingContactInfoForm'>]
- get_form_initial(step)[source]
Returns a dictionary which will be passed to the form for step as initial. If no initial data was provided while initializing the form wizard, an empty dictionary will be returned.
- get_form_instance(step)[source]
Returns an object which will be passed to the form for step as instance. If no instance object was provided while initializing the form wizard, None will be returned.
- get_form_kwargs(step=None)[source]
Returns the keyword arguments for instantiating the form (or formset) on the given step.
- process_step(form)[source]
This method is used to postprocess the form data. By default, it returns the raw form.data dictionary.
- template_name = 'onboarding.html'
Forms
- class pages.forms.OnboardingContactInfoForm(has_address, *args, **kwargs)[source]
- class Meta[source]
- layout = [('Text', '<h4 class="ui dividing header">Contact Information</h4>'), ('Text', '<div class="field"><label>Address / Office Location</label>'), ('Two Fields', ('Field', 'address'), ('Field', 'line_2')), ('Two Fields', ('Field', 'city'), ('Field', 'state')), ('Text', '</div>'), ('Field', 'phone'), ('Text', '<br>'), ('Text', '<div class="field"><label>Consent to receive text messages from LNL</label>'), ('Text', '<p style="color: black">LNL may periodically send you SMS text messages containing information about your business with us. This method of communication will never be used for marketing purposes and you may opt out at any time.</p></div>'), ('Field', 'sms'), ('Field', 'carrier'), ('Text', '<p style="color: darkgrey; padding-top: 2%; padding-bottom: 1%">By clicking next you agree to our <a href=\'https://lnl.wpi.edu/legal/privacy/\' target=\'_blank\'>Privacy Policy</a></p>')]
- base_fields = {'address': <django.forms.fields.CharField object>, 'carrier': <django.forms.fields.ChoiceField object>, 'city': <django.forms.fields.CharField object>, 'line_2': <django.forms.fields.CharField object>, 'phone': <django.forms.fields.CharField object>, 'sms': <django.forms.fields.ChoiceField object>, 'state': <django.forms.fields.CharField object>}
- declared_fields = {'address': <django.forms.fields.CharField object>, 'carrier': <django.forms.fields.ChoiceField object>, 'city': <django.forms.fields.CharField object>, 'line_2': <django.forms.fields.CharField object>, 'phone': <django.forms.fields.CharField object>, 'sms': <django.forms.fields.ChoiceField object>, 'state': <django.forms.fields.CharField object>}
- property media
Return all media required to render the widgets on this form.
- class pages.forms.OnboardingUserInfoForm(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]
- class Meta[source]
- fields = ('first_name', 'last_name', 'nickname', 'email', 'class_year', 'student_id', 'wpibox')
- layout = [('Text', '<h4 class="ui dividing header">Personal Information</h4>'), ('Text', '<div class="field"><label>Name <span style="color: red">*</span></label>'), ('Two Fields', ('Field', 'first_name'), ('Field', 'last_name')), ('Text', '</div>'), ('Field', 'nickname'), ('Field', 'email'), ('Text', '<br><h4 class="ui dividing header">Student Information</h4>'), ('Field', 'class_year'), ('Two Fields', ('Text', '<div class="field"><label>Student ID</label>'), ('Field', 'student_id'), ('Text', '</div><div class="field"><label>WPI Box Number</label>'), ('Field', 'wpibox'), ('Text', '</div>'))]
- base_fields = {'class_year': <django.forms.fields.CharField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'nickname': <django.forms.fields.CharField object>, 'student_id': <django.forms.fields.CharField object>, 'wpibox': <django.forms.fields.IntegerField object>}
- declared_fields = {'class_year': <django.forms.fields.CharField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'nickname': <django.forms.fields.CharField object>, 'student_id': <django.forms.fields.CharField object>, 'wpibox': <django.forms.fields.IntegerField object>}
- property media
Return all media required to render the widgets on this form.
- class pages.forms.SMSVerificationForm(user, *args, **kwargs)[source]
- class Meta[source]
- layout = [('Text', '<br><h4 class="ui dividing header">SMS Verification</h4>'), ('Text', '<p>A verification code was just sent to your phone. Check your messages and enter the 6-digit code below.</p>'), ('Field', 'code'), ('Text', "<div class='ui tiny message'>Didn't get your code? It may take a few minutes, so be patient. If after a few minutes you still haven't received your code, make sure you've entered your phone number correctly then try again.</div>")]
- base_fields = {'code': <django.forms.fields.CharField object>}
- declared_fields = {'code': <django.forms.fields.CharField object>}
- property media
Return all media required to render the widgets on this form.