Skip to content

Commit

Permalink
added location to registration
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Oct 16, 2015
1 parent ae126af commit 8d1eca6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions huntserver/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class RegistrationForm(forms.Form):
username = forms.CharField(label='Team Username', required=False)
password = forms.CharField(label='Team Password', widget=forms.PasswordInput())
confirm_password = forms.CharField(label='Confirm Password', required=False, widget=forms.PasswordInput())
location = forms.ChoiceField(label="Do you want to be provided a room on campus close to the hunt?", choices=([(1, "Yes"), (2, "No, we have a room"), (3, "No, we are a remote team")]))
first_name = forms.CharField(label='First Name')
last_name = forms.CharField(label='Last Name')
phone = forms.CharField(label='Phone Number', required=False)
Expand Down
20 changes: 20 additions & 0 deletions huntserver/migrations/0029_team_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('huntserver', '0028_hunt_team_size'),
]

operations = [
migrations.AddField(
model_name='team',
name='location',
field=models.CharField(default='N/A', max_length=80),
preserve_default=False,
),
]
19 changes: 19 additions & 0 deletions huntserver/migrations/0030_auto_20151016_1021.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('huntserver', '0029_team_location'),
]

operations = [
migrations.AlterField(
model_name='team',
name='location',
field=models.CharField(max_length=80, blank=True),
),
]
1 change: 1 addition & 0 deletions huntserver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Team(models.Model):
unlockables = models.ManyToManyField("Unlockable", blank=True)
login_info = models.OneToOneField(User)
hunt = models.ForeignKey(Hunt)
location = models.CharField(max_length=80, blank=True)

def __unicode__(self):
return self.team_name
Expand Down
4 changes: 4 additions & 0 deletions huntserver/templates/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ <h1 class="title">Registration</h1>
<td>{{ form.confirm_password.label_tag }}</td>
<td>{{ form.confirm_password }}</td>
</tr>
<tr>
<td>{{ form.location.label_tag }}</td>
<td>{{ form.location }}</td>
</tr>
</table>
<input type="button" class="back2to1" value="Back" />
<input type="submit" id="next2to3New" value="Next" />
Expand Down
3 changes: 2 additions & 1 deletion huntserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ def registration(request):
if (form.is_valid()):
# Make sure their passwords matched
if(form.cleaned_data['password'] == form.cleaned_data['confirm_password']):
loc = ["NAR", "Has a room", "offcampus"][int(form.cleaned_data['location'])-1]
u = User.objects.create_user(form.cleaned_data['username'],
password=form.cleaned_data['password'])
t = Team.objects.create(team_name = form.cleaned_data['team_name'],
login_info = u, hunt = curr_hunt)
login_info = u, hunt = curr_hunt, location=loc)
p = Person.objects.create(first_name = form.cleaned_data['first_name'],
last_name = form.cleaned_data['last_name'],
email = form.cleaned_data['email'],
Expand Down

0 comments on commit 8d1eca6

Please sign in to comment.