Browse Source

Some stuff I did. Sorry Arlin.

feature/python-error-tracking
Drew Larson 8 years ago
parent
commit
0c99334cd5
  1. 44
      bikeshop_project/core/forms.py
  2. 31
      bikeshop_project/core/migrations/0007_auto_20160501_2253.py
  3. 5
      bikeshop_project/core/models.py
  4. 158
      bikeshop_project/core/templates/membership_form.html
  5. 3
      bikeshop_project/core/urls.py
  6. 11
      bikeshop_project/core/views.py
  7. 18
      bikeshop_project/registration/forms.py
  8. 43
      bikeshop_project/registration/templates/member_form.html
  9. 3
      bower.json

44
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'}),
}

31
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',
),
]

5
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)

158
bikeshop_project/core/templates/membership_form.html

@ -0,0 +1,158 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% block styles %}
<link rel="stylesheet" href="{% static 'vendor/md-date-time-picker/dist/css/mdDateTimePicker.min.css' %}">
{% endblock %}
{% block content %}
<div class="mdl-cell mdl-cell--8-col">
<h1>New Membership</h1>
<form method="post">
{% csrf_token %}
<p>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.</p>
<h4>Member Privileges</h4>
<ul>
<li>Access to the BCBC tools, stands, and workspace</li>
<li>Access to friendly mechanical assistance and education when available</li>
<li>Opportunity to engage in decisions and help to build and develop the community's vision</li>
<li>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.</li>
</ul>
{% if form.non_field_errors %}
<div>
<span class="error">{{ form.errors }}</span>
</div>
{% endif %}
<div>
<h4>Member Responsibilities</h4>
<h5>Respect and Maintaining a Safe Space</h5>
<ul>
<li>Respect others and self</li>
<li>Help others</li>
<li>Racist, ableist, ageist, homophobic, sexist, and classist behavior and language will not be tolerated</li>
<li>The BCBC seeks to build a healthy lifestyle community, and behavior seen as hindering this objective will not be tolerated</li>
<li>Ask for help: With tools, processes, and even emotions</li>
</ul>
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ form.safe_space.id_for_label }}">
{{ form.safe_space }}
<span class="mdl-checkbox__label">I acknowledge the BCBC is a safe space and agree to maintain it.</span>
</label>
</div>
<div>
<h5>Respect the Community</h5>
<ul>
<li>Build positive relationships with Community Members</li>
<li>Build positive relationships with CNYC employees, volunteers, and patrons</li>
</ul>
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ form.respect_community.id_for_label }}">
{{ form.respect_community }}
<span class="mdl-checkbox__label">I will respect the community.</span>
</label>
</div>
<div>
<h5>Giving back</h5>
<p>
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 (<a href="mailto:volunteer@bridgecitybicyclecoop.com">volunteer@bridgecitybicyclecoop.com</a>)
</p>
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ form.give_back.id_for_label }}">
{{ form.give_back }}
<span class="mdl-checkbox__label">I acknowledge that giving back is important</span>
</label>
</div>
<div>
<h5>Respect the Space</h5>
<ul>
<li>Replace tools when not using them so that others can play too.</li>
<li>Do not steal or borrow articles within the space for personal use.</li>
<li>If you don't know what it is, how to use it, or where it goes, ask someone</li>
<li>Ensure you always leave time to clean up after yourself and others, and then do so</li>
<li>If you have to leave in the middle of a project, put pieces into a small bag and attach it to the bike</li>
<li>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.</li>
<li>Label your bike with your name, phone number, and the last date you worked on it.</li>
<li>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!</li>
</ul>
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ form.respect_shop.id_for_label }}">
{{ form.respect_shop }}
<span class="mdl-checkbox__label">I will respect the shop.</span>
</label>
</div>
<div class="">
<h2 class="template__header mdl-typography--title">Voluntary Self Identification</h2>
<p>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)</p>
{% for checkbox in form.self_identification %}
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ checkbox.id_for_label }}">
{{ checkbox }}
<span class="mdl-checkbox__label">{{ checkbox.label }}</span>
</label>
{% endfor %}
{% if form.self_identification.errors %}
<span class="mdl-textfield__error">{{ form.self_identification.errors }}</span>
{% else %}
<span class="mdl-textfield__error">Hmm</span>
{% endif %}
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label {% if form.gender_other.errors %}is-invalid{% endif %}">
{{ form.self_ident_other }}
<label class="mdl-textfield__label" for="{{ form.self_ident_other.id_for_label }}">{{ form.self_ident_other.label }}</label>
{% if form.self_ident_other.errors %}
<span class="mdl-textfield__error">{{ form.self_ident_other.errors }}</span>
{% endif %}
</div>
<div class="">
<h3 class="template__header mdl-typography--body-2">Gender Identification</h3>
{% for checkbox in form.gender %}
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ checkbox.id_for_label }}">
{{ checkbox }}
<span class="mdl-checkbox__label">{{ checkbox.label }}</span>
</label>
{% endfor %}
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label {% if form.gender_other.errors %}is-invalid{% endif %}">
{{ form.gender_other }}
<label class="mdl-textfield__label" for="{{ form.gender_other.id_for_label }}">{{ form.gender_other.label }}</label>
{% if form.gender_other.errors %}
<span class="mdl-textfield__error">{{ form.gender_other.errors }}</span>
{% endif %}
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label {% if form.renewed_at.errors %}is-invalid{% endif %}">
{{ form.renewed_at }}
<label class="mdl-textfield__label" for="{{ form.renewed_at.id_for_label }}">{{ form.renewed_at.label }}</label>
{% if form.renewed_at %}
<span class="mdl-textfield__error">{{ form.renewed_at.errors }}</span>
{% else %}
<span class="mdl-textfield__error">Incorrect date.</span>
{% endif %}
</div>
<div>
<button disabled="true" id="submit" type="submit" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored">Submit</button>
</div>
</form>
</div>
{% endblock %}
{% block scripts %}
<script src="{% static 'vendor/moment/min/moment.min.js' %}"></script>
<script src="{% static 'vendor/draggabilly/dist/draggabilly.pkgd.min.js' %}"></script>
<script src="{% static 'vendor/md-date-time-picker/dist/js/mdDateTimePicker.min.js' %}"></script>
<script>
var renewedAt = new mdDateTimePicker.default({
type: 'date',
past: moment().subtract(100, 'years'),
trigger: document.getElementById('{{ form.renewed_at.id_for_label }}')
});
document.getElementById('{{ form.renewed_at.id_for_label }}').addEventListener('focus', function() {
console.log('Toggle!');
renewedAt.toggle();
});
document.getElementById('{{ form.renewed_at.id_for_label }}').addEventListener('onOk', function () {
console.log('onOk');
this.parentNode.classList.add('is-dirty');
this.value = renewedAt.time.format('YYYY-MM-DD');
})
</script>
{% endblock %}

3
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()),
]

11
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')
return TemplateResponse(request, 'dashboard.html')
class NewMembershipView(View):
def get(self, request):
form = MembershipForm()
return TemplateResponse(request, 'membership_form.html', {'form': form})

18
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 = {

43
bikeshop_project/registration/templates/member_form.html

@ -184,48 +184,7 @@
<span class="mdl-textfield__error">{{ form.country.errors }}</span>
{% endif %}
</div>
{# <div class="">#}
{# <h2 class="template__header mdl-typography--title">Voluntary Self Identification</h2>#}
{# <p>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)</p>#}
{# {% for checkbox in form.self_identification %}#}
{# <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ checkbox.id_for_label }}">#}
{# {{ checkbox }}#}
{# <span class="mdl-checkbox__label">{{ checkbox.label }}</span>#}
{# </label>#}
{# {% endfor %}#}
{# {% if form.self_identification.errors %}#}
{# <span class="mdl-textfield__error">{{ form.self_identification.errors }}</span>#}
{# {% else %}#}
{# <span class="mdl-textfield__error">Hmm</span>#}
{# {% endif %}#}
{# </div>#}
{# <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label {% if form.gender_other.errors %}is-invalid{% endif %}">#}
{# {{ form.self_ident_other }}#}
{# <label class="mdl-textfield__label" for="{{ form.self_ident_other.id_for_label }}">{{ form.self_ident_other.label }}</label>#}
{# {% if form.self_ident_other.errors %}#}
{# <span class="mdl-textfield__error">{{ form.self_ident_other.errors }}</span>#}
{# {% endif %}#}
{# </div>#}
{# <div class="">#}
{# <h3 class="template__header mdl-typography--body-2">Gender Identification</h3>#}
{# {% for checkbox in form.gender %}#}
{# <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="{{ checkbox.id_for_label }}">#}
{# {{ checkbox }}#}
{# <span class="mdl-checkbox__label">{{ checkbox.label }}</span>#}
{# </label>#}
{# {% endfor %}#}
{# </div>#}
{# <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label {% if form.gender_other.errors %}is-invalid{% endif %}">#}
{# {{ form.gender_other }}#}
{# <label class="mdl-textfield__label" for="{{ form.gender_other.id_for_label }}">{{ form.gender_other.label }}</label>#}
{# {% if form.gender_other.errors %}#}
{# <span class="mdl-textfield__error">{{ form.gender_other.errors }}</span>#}
{# {% endif %}#}
{# </div>#}
<div class="">
<h6 class="template__header mdl-typography--title">Liability Waiver</h6>
<p><strong>Children under the age of 18 must have a parent or guardian co-sign the following waiver form.

3
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"
}
}

Loading…
Cancel
Save