diff --git a/bikeshop_project/bikeshop/urls.py b/bikeshop_project/bikeshop/urls.py index 08781c7..05aa77e 100644 --- a/bikeshop_project/bikeshop/urls.py +++ b/bikeshop_project/bikeshop/urls.py @@ -15,11 +15,11 @@ Including another URLconf """ from django.conf.urls import include, url from django.contrib import admin -from registration import urls as auth_urls from core import urls as core_urls +from registration import urls as member_urls urlpatterns = [ - url('^', include(auth_urls)), + url(r'^', include(core_urls)), + url(r'^member/', include(member_urls)), url(r'^admin/', admin.site.urls), - url('^', include(core_urls)), ] diff --git a/bikeshop_project/registration/forms.py b/bikeshop_project/registration/forms.py new file mode 100644 index 0000000..dddaf9d --- /dev/null +++ b/bikeshop_project/registration/forms.py @@ -0,0 +1,64 @@ +from django.forms import ModelForm, EmailInput, TextInput, DateInput, CheckboxSelectMultiple, CharField, CheckboxInput, BooleanField +from django.utils import timezone +from registration.models import Member + + +class MemberForm(ModelForm): + self_ident_other = CharField(required=False, label='Self identification', widget=TextInput(attrs={'class': 'mdl-textfield__input'})) + gender_other = CharField(required=False, label='Other', widget=TextInput(attrs={'class': 'mdl-textfield__input'})) + priveleges = BooleanField(label='I acknowledge', widget=CheckboxInput(attrs={'class': 'mdl-checkbox__input'})) + waiver_substitute = BooleanField(label='I have read and agree to the above terms & conditions.', widget=CheckboxInput(attrs={'class': 'mdl-checkbox__input'})) + + class Meta: + model = Member + self_ident_choices = ( + ('First Nations; Métis; or Inuit', 'First Nations; Métis; or Inuit'), + ('visible minority', 'Visible Minority'), + ('caucasian', 'Caucasian'), + ('Other', 'Other') + ) + gender_choices = ( + ('male', 'Male'), + ('female', 'Female'), + ('other', 'other') + ) + exclude = ('waiver',) + fields = ['email', 'email_consent', 'first_name', 'last_name', 'preferred_name', 'date_of_birth', + 'guardian_name', 'phone', 'street', 'city', 'province', 'country', 'post_code', 'self_identification', + 'gender', 'waiver'] + widgets = { + 'email': EmailInput(attrs={'class': 'mdl-textfield__input'}), + 'email_consent': CheckboxInput(attrs={'class': 'mdl-checkbox__input'}), + 'first_name': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'last_name': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'preferred_name': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'date_of_birth': DateInput(attrs={'class': 'mdl-textfield__input'}), + 'guardian_name': DateInput(attrs={'class': 'mdl-textfield__input', 'disabled': 'disabled'}), + 'phone': TextInput(attrs={'class': 'mdl-textfield__input', 'pattern': '[0-9]*'}), + 'street': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'city': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'province': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'country': TextInput(attrs={'class': 'mdl-textfield__input'}), + 'post_code': TextInput(attrs={'class': 'mdl-textfield__input', + 'pattern': '[A-Za-z][0-9][A-Za-z] [0-9][A-Za-z][0-9]'}), + 'self_identification': CheckboxSelectMultiple(choices=self_ident_choices, + attrs={'class': 'mdl-checkbox__input'}), + 'gender': CheckboxSelectMultiple(choices=gender_choices, attrs={'class': 'mdl-checkbox__input'}), + } + + labels = { + 'email_consent': 'I consent to receiving digital communication from the BCBC.' + } + + def clean(self): + super(MemberForm, self).clean() + + def save(self, *args, **kwargs): + commit = kwargs.pop('commit', True) + + instance = super(MemberForm, self).save(*args, commit=False, **kwargs) + if self.cleaned_data['waiver_substitute']: + instance.waiver = timezone.now() + if commit: + instance.save() + return instance diff --git a/bikeshop_project/registration/templates/member_form.html b/bikeshop_project/registration/templates/member_form.html new file mode 100644 index 0000000..c625a88 --- /dev/null +++ b/bikeshop_project/registration/templates/member_form.html @@ -0,0 +1,284 @@ +{% extends 'base.html' %} +{% load staticfiles %} + +{% block styles %} + +{% endblock %} + +{% block scripts %} + + + + + +{% endblock %} + +{% block content %} +
+

Membership

+

+ The Bridge City Bicycle Co-operative (herein referred to as The BCBC and The Community) is a nonprofit, + community bicycle repair education and resource co-operative. We offer our members nonjudgmental repair + space, tools and instruction during business hours (hours on website) by donation, and educational + workshops. We also offer reconditioned/recycled low cost bikes and parts for sale. + The BCBC is operated by volunteers; a medley of professionals, students, bike enthusiasts, activists, + and other community members who share a love for cycling in Saskatoon. Membership is open to all + individuals and costs $20 per year. A receipt will be issued to you once your membership fee has been paid. +

+
+ {% csrf_token %} + + {% if form.non_field_errors %} +
+ {{ form.errors }} +
+ {% endif %} +
+ {{ form.email }} + + {% if form.email.errors %} + {{ form.email.errors }} + {% else %} + Invalid email. + {% endif %} +
+
+ +
+
+ {{ form.first_name }} + + {% if form.first_name.errors %} + {{ form.first_name.errors }} + {% else %} + Name too long. + {% endif %} +
+
+ {{ form.last_name }} + + {% if form.last_name.errors %} + {{ form.last_name.errors }} + {% else %} + Name too long. + {% endif %} +
+
+ {{ form.preferred_name }} + + {% if form.preferred_name.errors %} + {{ form.preferred_name.errors }} + {% else %} + Name too long. + {% endif %} +
+
+ {{ form.date_of_birth }} + + {% if form.date_of_birth.errors %} + {{ form.date_of_birth.errors }} + {% else %} + Incorrect date. + {% endif %} +
+
+ {{ form.guardian_name }} + + {% if form.guardian_name.errors %} + {{ form.guardian_name.errors }} + {% else %} + Name too long. + {% endif %} +
+
+ {{ form.phone }} + + {% if form.phone.errors %} + {{ form.phone.errors }} + {% else %} + Digits only. + {% endif %} +
+
+ {{ form.post_code }} + + {% if form.post_code.errors %} + {{ form.post_code.errors }} + {% else %} + Format: A0A 0A0 + {% endif %} +
+
+ {{ form.street }} + + {% if form.street.errors %} + {{ form.street.errors }} + {% endif %} +
+
+ {{ form.city }} + + {% if form.city.errors %} + {{ form.city.errors }} + {% endif %} +
+
+ {{ form.province }} + + {% if form.province.errors %} + {{ form.province.errors }} + {% endif %} +
+
+ {{ form.country }} + + {% if form.country.errors %} + {{ form.country.errors }} + {% endif %} +
+
+

Voluntary Self Identification

+

We want to make sure that all members of our community, regardless of race, ethnicity, and gender + are able to participate fully in the BCBC. Please share information about your race and/or + ethnicity so that we can track how well we are including all communities and whether there may be + barriers to certain groups’ participation. Thank you! Do you identify as: (In each category, check + all that apply)

+ {% for checkbox in form.self_identification %} + + {% endfor %} + {% if form.self_identification.errors %} + {{ form.self_identification.errors }} + {% else %} + Hmm + {% endif %} +
+
+ {{ form.self_ident_other }} + + {% if form.self_ident_other.errors %} + {{ form.self_ident_other.errors }} + {% endif %} +
+
+

Gender Identification

+ {% for checkbox in form.gender %} + + {% endfor %} +
+
+ {{ form.gender_other }} + + {% if form.gender_other.errors %} + {{ form.gender_other.errors }} + {% endif %} +
+
+
Member Liability Waiver
+

Children under the age of 18 must have a parent or guardian co-sign the following waiver form. +
Children under the age of 13 must have guardian supervision when participating in BCBC activities and events.

+

By signing this form in the space provided below, I hereby assume all of the risks of participating and/or volunteering in the Bridge City Bicycle Co-operative, hereinafter referred to as the BCBC and the Community. I realize that liability may arise from negligence or carelessness on the part of the persons or entities being released, from dangerous or defective equipment or property owned, maintained or controlled by them or because of their possible liability without fault. I acknowledge that this Accident Waiver and Release of Liability form will be used by the Community, sponsors and organizers, in which I may participate and that it will govern my actions and responsibilities during my use of its services. In consideration of my application and permitting me to participate in this program, I hereby take action for myself, my executors, administrators, heirs, next of kin, successors, and assigns as follows:

+

(A) Waive, Release and Discharge from any and all liability for my death, disability, personal injury, property damage, property theft or actions of any kind which may hereafter accrue to me including my travelling to and from space or using the shop's bicycle, equipment or other facilities, THE FOLLOWING ENTITIES OR PERSONS: The directors, officers, employees, volunteers, representatives, and agents, the event holders, sponsors, volunteers of the Community;

+

(B) Indemnify and Hold Harmless the entities and persons set forth in (A) above from any and all liabilities and claims arising from my participation in the Community, including my use of a bicycle belonging to the Community, irrespective of whether the cause of the claims or liability arise from the negligence, acts or omissions of me, a third party, or the Community.

+ +
+
+

Privacy Policy

+

Bridge City Bicycle Co-operative (BCBC) values the trust of its volunteers, staff, and members and + is committed to protecting the privacy of all personal information entrusted to it. BCBC only + collects the limited personal information needed to deliver high quality services and programming. + Collected information will be used only for the purpose expressly identified or for other purposes + which could be reasonably considered to be consistent with out mission. We do not sell, rent or + trade personal information. The personal information collected will be protected with appropriate + physical, organizational, and electronic safeguards to prevent unauthorized use and will be + retained only for as long as needed to achieve the purposes stated above. BCBC may make personal + information available to others or to appropriate authorities without permission if the information + is used to take action during an emergency that threatens the life, health or security of an + individual. Information no longer required will be destroyed or erased. Upon application to the + Privacy Officer individuals may access their personal information held by BCBC unless the + information contains references to other individuals or cannot be disclosed for legal or security + reasons. BCBC commits to promptly correcting any inaccuracies. Complaints should be made in writing + to the Privacy Officer who will immediately acknowledge receipt and will respond to the complaint + within 30 days. Unresolved complaints may be taken to the federal Privacy Commissioner.

+

Contact BCBC’s Privacy Officer at: +
905 20th Street West Saskatoon, SK S7M 0Y5 or by: +
Email: bridgecitybicyclecoop@gmail.com

+
+
+

Membership and Privileges

+

I acknowledge that my Membership and Privileges in the Bridge City Bicycle Co-operative is contingent + upon fulfilling the above responsibilities.

+ +
+
+ +
+
+
+{% endblock %} \ No newline at end of file diff --git a/bikeshop_project/registration/urls.py b/bikeshop_project/registration/urls.py index a96e173..26c068d 100644 --- a/bikeshop_project/registration/urls.py +++ b/bikeshop_project/registration/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import url -from django.contrib.auth import views +from .views import MemberFormView urlpatterns = [ - url(r'^login/$', views.login, {'template_name': 'login.html'}), + url(r'^new/$', MemberFormView.as_view()), ] diff --git a/bikeshop_project/registration/views.py b/bikeshop_project/registration/views.py new file mode 100644 index 0000000..cfc8342 --- /dev/null +++ b/bikeshop_project/registration/views.py @@ -0,0 +1,22 @@ +from django.template.response import TemplateResponse +from django.utils import timezone +from django.views.generic import View + +from .forms import MemberForm + + +class MemberFormView(View): + def get(self, request): + form = MemberForm() + context = {'form': form} + return TemplateResponse(request, 'member_form.html', context=context) + + def post(self, request): + form = MemberForm(request.POST) + + if form.is_valid(): + form.save() + return TemplateResponse(request, 'member_created.html') + + context = {'form': form} + return TemplateResponse(request, 'member_form.html', context=context)