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 %} +
+ 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. +
+ +