From 0c99334cd5d40148f475d9270600ac80f8469504 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Wed, 25 May 2016 17:59:54 -0600 Subject: [PATCH 01/20] Some stuff I did. Sorry Arlin. --- bikeshop_project/core/forms.py | 44 +++++ .../migrations/0007_auto_20160501_2253.py | 31 ++++ bikeshop_project/core/models.py | 5 - .../core/templates/membership_form.html | 158 ++++++++++++++++++ bikeshop_project/core/urls.py | 3 +- bikeshop_project/core/views.py | 11 +- bikeshop_project/registration/forms.py | 18 +- .../registration/templates/member_form.html | 43 +---- bower.json | 3 +- 9 files changed, 249 insertions(+), 67 deletions(-) create mode 100644 bikeshop_project/core/forms.py create mode 100644 bikeshop_project/core/migrations/0007_auto_20160501_2253.py create mode 100644 bikeshop_project/core/templates/membership_form.html diff --git a/bikeshop_project/core/forms.py b/bikeshop_project/core/forms.py new file mode 100644 index 0000000..59dde4f --- /dev/null +++ b/bikeshop_project/core/forms.py @@ -0,0 +1,44 @@ +from django.forms import ModelForm, TextInput, DateInput, CheckboxSelectMultiple, CharField, BooleanField, CheckboxInput + +from core.models import Membership + + +class MembershipForm(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'})) + safe_space = BooleanField(required=True, widget=CheckboxInput( + attrs={'class': 'mdl-checkbox__input'} + )) + respect_community = BooleanField(required=True, widget=CheckboxInput( + attrs={'class': 'mdl-checkbox__input'} + )) + give_back = BooleanField(required=True, widget=CheckboxInput( + attrs={'class': 'mdl-checkbox__input'} + )) + respect_shop = BooleanField(required=True, widget=CheckboxInput( + attrs={'class': 'mdl-checkbox__input'} + )) + + class Meta: + model = Membership + fields = ['renewed_at', 'self_identification', 'gender'] + + 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') + ) + + widgets = { + 'self_identification': CheckboxSelectMultiple(choices=self_ident_choices, + attrs={'class': 'mdl-checkbox__input'}), + 'gender': CheckboxSelectMultiple(choices=gender_choices, attrs={'class': 'mdl-checkbox__input'}), + 'renewed_at': TextInput(attrs={'class': 'mdl-textfield__input'}), + } diff --git a/bikeshop_project/core/migrations/0007_auto_20160501_2253.py b/bikeshop_project/core/migrations/0007_auto_20160501_2253.py new file mode 100644 index 0000000..1219ac9 --- /dev/null +++ b/bikeshop_project/core/migrations/0007_auto_20160501_2253.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-01 22:53 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0006_auto_20160410_1833'), + ] + + operations = [ + migrations.RemoveField( + model_name='membership', + name='acknowledgement', + ), + migrations.RemoveField( + model_name='membership', + name='community', + ), + migrations.RemoveField( + model_name='membership', + name='give_back', + ), + migrations.RemoveField( + model_name='membership', + name='safe_space', + ), + ] diff --git a/bikeshop_project/core/models.py b/bikeshop_project/core/models.py index fb9b364..8cd0d6a 100644 --- a/bikeshop_project/core/models.py +++ b/bikeshop_project/core/models.py @@ -11,11 +11,6 @@ class Membership(models.Model): on_delete=models.CASCADE, related_name='membership' ) - safe_space = models.BooleanField(default=False) - community = models.BooleanField(default=False) - give_back = models.BooleanField(default=False) - # this should be a form field that requires the new member to type out there full name - acknowledgement = models.BooleanField(default=False) self_identification = models.CharField(max_length=255, null=True, blank=True) gender = models.CharField(max_length=255, null=True, blank=True) involvement = models.CharField(max_length=255, null=True, blank=True) diff --git a/bikeshop_project/core/templates/membership_form.html b/bikeshop_project/core/templates/membership_form.html new file mode 100644 index 0000000..91f7165 --- /dev/null +++ b/bikeshop_project/core/templates/membership_form.html @@ -0,0 +1,158 @@ +{% extends 'base.html' %} +{% load staticfiles %} + +{% block styles %} + +{% endblock %} + +{% block content %} +
+

New Membership

+
+ {% csrf_token %} +

The Bridge City Bicycle Co­operative aims to be a safe and respectful environment geared towards education, empowerment and community­building. In order to do so we need your input and support.

+ +

Member Privileges

+
    +
  • Access to the BCBC tools, stands, and workspace
  • +
  • Access to friendly mechanical assistance and education when available
  • +
  • Opportunity to engage in decisions and help to build and develop the community's vision
  • +
  • The 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. As such, collected information will be used in accordance with our privacy policy outlined on our website and in our shop.
  • +
+ {% if form.non_field_errors %} +
+ {{ form.errors }} +
+ {% endif %} +
+

Member Responsibilities

+
Respect and Maintaining a Safe Space
+
    +
  • Respect others and self
  • +
  • Help others
  • +
  • Racist, ableist, ageist, homophobic, sexist, and classist behavior and language will not be tolerated
  • +
  • The BCBC seeks to build a healthy lifestyle community, and behavior seen as hindering this objective will not be tolerated
  • +
  • Ask for help: With tools, processes, and even emotions
  • +
+ +
+
+
Respect the Community
+
    +
  • Build positive relationships with Community Members
  • +
  • Build positive relationships with CNYC employees, volunteers, and patrons
  • +
+ +
+
+
Giving back
+

+ Our services are free and Members are encouraged to contribute in any way they can. Our vibrancy comes from the volunteer work of a large community with diverse skills and passions. There are so many ways to be a part of this community, regardless of whether or not you know how to change a tire (yet!). Ask how you can help out or get in touch with our volunteer coordinator (volunteer@bridgecitybicyclecoop.com) +

+ +
+
+
Respect the Space
+
    +
  • Replace tools when not using them so that others can play too.
  • +
  • Do not steal or borrow articles within the space for personal use.
  • +
  • If you don't know what it is, how to use it, or where it goes, ask someone
  • +
  • Ensure you always leave time to clean up after yourself and others, and then do so
  • +
  • If you have to leave in the middle of a project, put pieces into a small bag and attach it to the bike
  • +
  • Personal projects may be kept at the BCBC for a maximum of one day; however, this is highly discouraged due to lack of space and the concern for theft.
  • +
  • Label your bike with your name, phone number, and the last date you worked on it.
  • +
  • Do not force tools and use them only for their intended use. If you need help or guidance, ask someone! It’s what we’re here for!
  • +
+ +
+
+

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 %} +
+
+ {{ form.renewed_at }} + + {% if form.renewed_at %} + {{ form.renewed_at.errors }} + {% else %} + Incorrect date. + {% endif %} +
+
+ +
+
+
+{% endblock %} + +{% block scripts %} + + + + + {% endblock %} \ No newline at end of file diff --git a/bikeshop_project/core/urls.py b/bikeshop_project/core/urls.py index f7687bd..1863202 100644 --- a/bikeshop_project/core/urls.py +++ b/bikeshop_project/core/urls.py @@ -1,6 +1,7 @@ from django.conf.urls import url -from .views import DashboardView +from .views import DashboardView, NewMembershipView urlpatterns = [ + url(r'^membership/new/$', NewMembershipView.as_view()), url(r'^$', DashboardView.as_view()), ] diff --git a/bikeshop_project/core/views.py b/bikeshop_project/core/views.py index aa475e1..c94c5a5 100644 --- a/bikeshop_project/core/views.py +++ b/bikeshop_project/core/views.py @@ -1,7 +1,16 @@ from django.template.response import TemplateResponse from django.views.generic import View +from core.forms import MembershipForm + class DashboardView(View): def get(self, request): - return TemplateResponse(request, 'dashboard.html') \ No newline at end of file + return TemplateResponse(request, 'dashboard.html') + + +class NewMembershipView(View): + def get(self, request): + form = MembershipForm() + + return TemplateResponse(request, 'membership_form.html', {'form': form}) diff --git a/bikeshop_project/registration/forms.py b/bikeshop_project/registration/forms.py index bcc7694..ccc1b43 100644 --- a/bikeshop_project/registration/forms.py +++ b/bikeshop_project/registration/forms.py @@ -4,24 +4,11 @@ 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', 'waiver'] @@ -40,9 +27,6 @@ class MemberForm(ModelForm): '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 = { diff --git a/bikeshop_project/registration/templates/member_form.html b/bikeshop_project/registration/templates/member_form.html index caf00b1..0858db6 100644 --- a/bikeshop_project/registration/templates/member_form.html +++ b/bikeshop_project/registration/templates/member_form.html @@ -184,48 +184,7 @@ {{ 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 %}#} -{#
#} +
Liability Waiver

Children under the age of 18 must have a parent or guardian co-sign the following waiver form. diff --git a/bower.json b/bower.json index 3f5bc4c..7c4a3af 100644 --- a/bower.json +++ b/bower.json @@ -17,6 +17,7 @@ "tests" ], "dependencies": { - "material-design-lite": "^1.1.3" + "material-design-lite": "^1.1.3", + "md-date-time-picker": "https://github.com/puranjayjain/md-date-time-picker.git#master" } } From 4c8b60b0eaecb4b303cf8bfec54d281ccaf3f10d Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Wed, 25 May 2016 18:21:17 -0600 Subject: [PATCH 02/20] Enable submit button once everything is agreed to. --- .../core/templates/membership_form.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bikeshop_project/core/templates/membership_form.html b/bikeshop_project/core/templates/membership_form.html index 91f7165..530119b 100644 --- a/bikeshop_project/core/templates/membership_form.html +++ b/bikeshop_project/core/templates/membership_form.html @@ -154,5 +154,22 @@ this.parentNode.classList.add('is-dirty'); this.value = renewedAt.time.format('YYYY-MM-DD'); }) + + var responsibilities = [ + document.getElementById('{{ form.safe_space.id_for_label }}'), + document.getElementById('{{ form.respect_community.id_for_label }}'), + document.getElementById('{{ form.give_back.id_for_label }}'), + document.getElementById('{{ form.respect_shop.id_for_label }}') + ]; + var checkResponsiblities = function () { + allAgreed = responsibilities.every(function (checkbox) { + return checkbox.checked + }); + var submitButton = document.getElementById('submit'); + submitButton.disabled = !allAgreed; + }; + responsibilities.forEach(function (checkbox) { + checkbox.addEventListener('click', checkResponsiblities) + }) {% endblock %} \ No newline at end of file From 40254d9df1e1a0be237928b6d0239db3ccfa5702 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Wed, 25 May 2016 18:46:33 -0600 Subject: [PATCH 03/20] Add submit form. --- bikeshop_project/core/urls.py | 4 ++-- bikeshop_project/core/views.py | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bikeshop_project/core/urls.py b/bikeshop_project/core/urls.py index 1863202..a1f694e 100644 --- a/bikeshop_project/core/urls.py +++ b/bikeshop_project/core/urls.py @@ -2,6 +2,6 @@ from django.conf.urls import url from .views import DashboardView, NewMembershipView urlpatterns = [ - url(r'^membership/new/$', NewMembershipView.as_view()), - url(r'^$', DashboardView.as_view()), + url(r'^membership/new/$', NewMembershipView.as_view(), name='new_membership'), + url(r'^$', DashboardView.as_view()) ] diff --git a/bikeshop_project/core/views.py b/bikeshop_project/core/views.py index c94c5a5..332e9a3 100644 --- a/bikeshop_project/core/views.py +++ b/bikeshop_project/core/views.py @@ -1,5 +1,8 @@ +from django.contrib import messages +from django.http import HttpResponseRedirect from django.template.response import TemplateResponse -from django.views.generic import View +from django.views.generic import TemplateView, View +from django.core.urlresolvers import reverse from core.forms import MembershipForm @@ -9,8 +12,19 @@ class DashboardView(View): return TemplateResponse(request, 'dashboard.html') -class NewMembershipView(View): +class NewMembershipView(TemplateView): + template_name = 'membership_form.html' def get(self, request): form = MembershipForm() + return self.render_to_response(dict(form=form)) - return TemplateResponse(request, 'membership_form.html', {'form': form}) + def post(self, request): + form = MembershipForm(request.POST) + + if form.is_valid(): + member = form.save() + messages.add_message(request, messages.SUCCESS, 'Successfully created our newest member, {first} {last}' + .format(first=member.first_name, last=member.last_name)) + return HttpResponseRedirect(reverse('new_membership')) + + return self.render_to_response(dict(form=form)) From 6dcadff05674caa07773759dc0b3dcfba83cb893 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Wed, 25 May 2016 18:57:17 -0600 Subject: [PATCH 04/20] Add admin views. --- bikeshop_project/core/admin.py | 2 ++ bikeshop_project/registration/admin.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/bikeshop_project/core/admin.py b/bikeshop_project/core/admin.py index 8c38f3f..cedce61 100644 --- a/bikeshop_project/core/admin.py +++ b/bikeshop_project/core/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin +from .models import Membership, Payment # Register your models here. +admin.site.register([Membership, Payment]) diff --git a/bikeshop_project/registration/admin.py b/bikeshop_project/registration/admin.py index 8c38f3f..388b91c 100644 --- a/bikeshop_project/registration/admin.py +++ b/bikeshop_project/registration/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin +from .models import Member + # Register your models here. +admin.site.register(Member) \ No newline at end of file From 3890fe41a85578faa96142c8bc21a0a8e35d3063 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 10:25:54 -0600 Subject: [PATCH 05/20] Move payment field to membership. --- .../migrations/0008_auto_20160526_0059.py | 25 +++++++++++++++++++ bikeshop_project/core/models.py | 15 +++++------ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 bikeshop_project/core/migrations/0008_auto_20160526_0059.py diff --git a/bikeshop_project/core/migrations/0008_auto_20160526_0059.py b/bikeshop_project/core/migrations/0008_auto_20160526_0059.py new file mode 100644 index 0000000..b980641 --- /dev/null +++ b/bikeshop_project/core/migrations/0008_auto_20160526_0059.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-26 00:59 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0007_auto_20160501_2253'), + ] + + operations = [ + migrations.RemoveField( + model_name='payment', + name='membership', + ), + migrations.AddField( + model_name='membership', + name='payment', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Payment'), + ), + ] diff --git a/bikeshop_project/core/models.py b/bikeshop_project/core/models.py index 8cd0d6a..c0f02c8 100644 --- a/bikeshop_project/core/models.py +++ b/bikeshop_project/core/models.py @@ -6,21 +6,18 @@ class Membership(models.Model): created_at = models.DateTimeField(auto_now_add=True) modified_at = models.DateTimeField(auto_now=True) renewed_at = models.DateTimeField(default=timezone.now) - member = models.OneToOneField( - 'registration.Member', - on_delete=models.CASCADE, - related_name='membership' - ) self_identification = models.CharField(max_length=255, null=True, blank=True) gender = models.CharField(max_length=255, null=True, blank=True) involvement = models.CharField(max_length=255, null=True, blank=True) + payment = models.ForeignKey( + 'Payment', + on_delete=models.CASCADE, + blank=False, + null=True + ) class Payment(models.Model): - membership = models.ForeignKey( - 'Membership', - on_delete=models.CASCADE, - ) payment_choices = ( ('CASH', 'cash'), ('CHEQUE', 'cheque'), From 4a01e29b9fcaf5b96ce33671ed75e5fe1443bf8e Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 10:26:23 -0600 Subject: [PATCH 06/20] Move membership to Member. --- .../0009_remove_membership_member.py | 19 ++++++++++++++++ .../migrations/0005_member_membership.py | 22 +++++++++++++++++++ bikeshop_project/registration/models.py | 7 ++++++ 3 files changed, 48 insertions(+) create mode 100644 bikeshop_project/core/migrations/0009_remove_membership_member.py create mode 100644 bikeshop_project/registration/migrations/0005_member_membership.py diff --git a/bikeshop_project/core/migrations/0009_remove_membership_member.py b/bikeshop_project/core/migrations/0009_remove_membership_member.py new file mode 100644 index 0000000..6a8d3ba --- /dev/null +++ b/bikeshop_project/core/migrations/0009_remove_membership_member.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-26 01:50 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0008_auto_20160526_0059'), + ] + + operations = [ + migrations.RemoveField( + model_name='membership', + name='member', + ), + ] diff --git a/bikeshop_project/registration/migrations/0005_member_membership.py b/bikeshop_project/registration/migrations/0005_member_membership.py new file mode 100644 index 0000000..d6c4c1c --- /dev/null +++ b/bikeshop_project/registration/migrations/0005_member_membership.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2016-05-26 01:50 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0009_remove_membership_member'), + ('registration', '0004_auto_20160410_1816'), + ] + + operations = [ + migrations.AddField( + model_name='member', + name='membership', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='member', to='core.Membership'), + ), + ] diff --git a/bikeshop_project/registration/models.py b/bikeshop_project/registration/models.py index fb5ef45..8905f32 100644 --- a/bikeshop_project/registration/models.py +++ b/bikeshop_project/registration/models.py @@ -59,6 +59,13 @@ class Member(AbstractBaseUser, PermissionsMixin): waiver = models.DateTimeField(null=True, blank=True) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) + membership = models.OneToOneField( + 'core.Membership', + on_delete=models.CASCADE, + related_name='member', + blank=True, + null=True + ) objects = CustomMemberManager() From 47f0b3e03ff9f5af94c3a0f8a6951d9ef95b0a23 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 10:27:25 -0600 Subject: [PATCH 07/20] Edit member WIP. --- .../templates/edit_member_form.html | 197 ++++++++++++++++++ bikeshop_project/registration/urls.py | 1 + bikeshop_project/registration/views.py | 18 +- 3 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 bikeshop_project/registration/templates/edit_member_form.html diff --git a/bikeshop_project/registration/templates/edit_member_form.html b/bikeshop_project/registration/templates/edit_member_form.html new file mode 100644 index 0000000..e1ca6b2 --- /dev/null +++ b/bikeshop_project/registration/templates/edit_member_form.html @@ -0,0 +1,197 @@ +{% extends 'base.html' %} +{% load staticfiles %} + +{% block styles %} + +{% endblock %} + +{% block scripts %} + + + + + +{% endblock %} + +{% block content %} +

+

{{ form.instance.first_name }} {{ form.instance.last_name }}

+

+ 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 %} +
+
+ +
+
+
+ {% if not form.instance.membership %} +
+

No membership found.

+
+ {% endif %} +{% endblock %} diff --git a/bikeshop_project/registration/urls.py b/bikeshop_project/registration/urls.py index 84781dd..07024cb 100644 --- a/bikeshop_project/registration/urls.py +++ b/bikeshop_project/registration/urls.py @@ -3,4 +3,5 @@ from django.conf.urls import url from .views import MemberFormView urlpatterns = [ url(r'^new/$', MemberFormView.as_view(), name='signup'), + url(r'^edit/(?P[0-9]+)/$', MemberFormView.as_view(), name='member_edit') ] diff --git a/bikeshop_project/registration/views.py b/bikeshop_project/registration/views.py index cfc8342..3fad6e2 100644 --- a/bikeshop_project/registration/views.py +++ b/bikeshop_project/registration/views.py @@ -1,14 +1,26 @@ +from django.shortcuts import get_object_or_404 from django.template.response import TemplateResponse from django.utils import timezone from django.views.generic import View from .forms import MemberForm +from .models import Member +import logging +logger = logging.getLogger(__file__) class MemberFormView(View): - def get(self, request): - form = MemberForm() - context = {'form': form} + def get(self, request, member_id=None): + try: + logger.debug(member_id) + member = Member.objects.get(id=member_id) + form = MemberForm(instance=member) + except Member.DoesNotExist: + form = MemberForm() + + context = dict(form=form) + if form.instance: + return TemplateResponse(request, 'edit_member_form.html', context=context) return TemplateResponse(request, 'member_form.html', context=context) def post(self, request): From 9f0da067562022c6c1c896b93be9fe78b1106ac5 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 18:29:22 -0600 Subject: [PATCH 08/20] All the restarts! --- provision/roles/supervisor/development/supervisor-program.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/provision/roles/supervisor/development/supervisor-program.conf b/provision/roles/supervisor/development/supervisor-program.conf index 882d035..ed44f00 100644 --- a/provision/roles/supervisor/development/supervisor-program.conf +++ b/provision/roles/supervisor/development/supervisor-program.conf @@ -8,3 +8,4 @@ autostart=true autorestart=true redirect_stderr=true user=vagrant +startretries=100000 From f22f39f67f02ff263a997835a765446fc24219c1 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 26 May 2016 18:30:33 -0600 Subject: [PATCH 09/20] Saner member sign-up! --- bikeshop_project/registration/forms.py | 2 +- .../templates/edit_member_form.html | 6 ++-- .../registration/templates/member_form.html | 14 ++++++---- bikeshop_project/registration/views.py | 28 +++++++++++++------ 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/bikeshop_project/registration/forms.py b/bikeshop_project/registration/forms.py index ccc1b43..a1da26d 100644 --- a/bikeshop_project/registration/forms.py +++ b/bikeshop_project/registration/forms.py @@ -4,7 +4,7 @@ from registration.models import Member class MemberForm(ModelForm): - waiver_substitute = BooleanField(label='I have read and agree to the above terms & conditions.', widget=CheckboxInput(attrs={'class': 'mdl-checkbox__input'})) + waiver_substitute = BooleanField(required=False, label='I have read and agree to the above terms & conditions.', widget=CheckboxInput(attrs={'class': 'mdl-checkbox__input'})) class Meta: model = Member diff --git a/bikeshop_project/registration/templates/edit_member_form.html b/bikeshop_project/registration/templates/edit_member_form.html index e1ca6b2..288e25f 100644 --- a/bikeshop_project/registration/templates/edit_member_form.html +++ b/bikeshop_project/registration/templates/edit_member_form.html @@ -2,16 +2,16 @@ {% load staticfiles %} {% block styles %} - + {% endblock %} {% block scripts %} - + - +