Skip to content

Commit

Permalink
Very large merge of single user auth into master
Browse files Browse the repository at this point in the history
Warning: This makes many of the previous commits incompatible
and any existing databases will need to be regenerated.

This

Conflicts:
	huntserver/views.py
	puzzlehunt_server/settings.py
  • Loading branch information
dlareau committed Jan 8, 2016
2 parents 2a6156b + 8651623 commit 4d64bca
Show file tree
Hide file tree
Showing 74 changed files with 694 additions and 926 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/static/
/media/
/huntserver/static/huntserver/*.pdf
/huntserver/static/huntserver/*.png
/huntserver/static/huntserver/puzzles/*
/puzzlehunt_server/secret_settings.py
/docs/_build/
Expand Down
12 changes: 6 additions & 6 deletions huntserver/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ def formfield_for_manytomany(self, db_field, request, **kwargs):
kwargs["queryset"] = Puzzle.objects.filter(hunt=Hunt.objects.get(hunt_number=settings.CURRENT_HUNT_NUM)).order_by('puzzle_id')
return super(PuzzleAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
list_filter = ('hunt',)
inlines = (UnlockableInline, )
filter_horizontal = ('unlocks',)

class PersonInline(admin.TabularInline):
model = Person
extra = 5
max_num = 5
# class PersonInline(admin.TabularInline):
# model = Person
# extra = 5
# max_num = 5

class TeamAdmin(admin.ModelAdmin):
inlines = (PersonInline, )
# inlines = (PersonInline, )
list_filter = ('hunt',)

admin.site.register(Hunt)
Expand Down
44 changes: 32 additions & 12 deletions huntserver/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django import forms
from .models import Person
from django.contrib.auth.models import User

class AnswerForm(forms.Form):
answer = forms.CharField(max_length=100, label='Answer')
Expand All @@ -11,17 +13,35 @@ class UnlockForm(forms.Form):
team_id = forms.CharField(label='team_id')
puzzle_id = forms.CharField(label='puzzle_id')

class RegistrationForm(forms.Form):
team_name = forms.CharField(label='Team Name')
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")]), required=False)
first_name = forms.CharField(label='First Name')
last_name = forms.CharField(label='Last Name')
phone = forms.CharField(label='Phone Number', required=False)
email = forms.EmailField(label='Email')
dietary_issues = forms.CharField(label='Dietary Restrictions?', required=False, widget = forms.Textarea(attrs={'rows': 4, 'cols': 40}))
year = forms.ChoiceField(label='School Year', choices=([(1,"Freshman"), (2,"Sophomore"), (3,"Junior"), (4,"Senior"), (5,"Graduate"), (0,"N/A")]))
class PersonForm(forms.ModelForm):
class Meta:
model = Person
fields = ['phone', 'allergies']

class UserForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(UserForm, self).__init__(*args, **kwargs)
self.fields['email'].required = True
self.fields['first_name'].required = True
self.fields['last_name'].required = True

required_css_class = 'required'
confirm_password = forms.CharField(label='Confirm Password')
class Meta:
model = User
fields = ['first_name', 'last_name', 'email', 'username', 'password']

# class RegistrationForm(forms.Form):
# team_name = forms.CharField(label='Team Name')
# 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")]), required=False)
# first_name = forms.CharField(label='First Name')
# last_name = forms.CharField(label='Last Name')
# phone = forms.CharField(label='Phone Number', required=False)
# email = forms.EmailField(label='Email')
# dietary_issues = forms.CharField(label='Dietary Restrictions?', required=False, widget = forms.Textarea(attrs={'rows': 4, 'cols': 40}))
# year = forms.ChoiceField(label='School Year', choices=([(1,"Freshman"), (2,"Sophomore"), (3,"Junior"), (4,"Senior"), (5,"Graduate"), (0,"N/A")]))


79 changes: 73 additions & 6 deletions huntserver/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('hunt_name', models.CharField(max_length=200)),
('hunt_number', models.IntegerField(unique=True)),
('team_size', models.IntegerField()),
('start_date', models.DateTimeField()),
('end_date', models.DateTimeField()),
],
),
migrations.CreateModel(
name='Message',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('is_response', models.BooleanField()),
('text', models.CharField(max_length=400)),
('time', models.DateTimeField()),
],
),
migrations.CreateModel(
Expand All @@ -27,20 +39,31 @@ class Migration(migrations.Migration):
('first_name', models.CharField(max_length=20)),
('last_name', models.CharField(max_length=20)),
('email', models.EmailField(max_length=254)),
('phone', models.CharField(max_length=20)),
('comments', models.CharField(max_length=400)),
('phone', models.CharField(max_length=20, blank=True)),
('comments', models.CharField(max_length=400, blank=True)),
('year', models.IntegerField(null=True, blank=True)),
('login_info', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Puzzle',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('puzzle_number', models.IntegerField()),
('puzzle_name', models.CharField(max_length=200)),
('puzzle_id', models.CharField(unique=True, max_length=8)),
('answer', models.CharField(max_length=100)),
('link', models.URLField()),
('num_required_to_unlock', models.IntegerField(default=1)),
('hunt', models.ForeignKey(to='huntserver.Hunt')),
('unlocks', models.ManyToManyField(related_name='unlocks_rel_+', to='huntserver.Puzzle')),
('unlocks', models.ManyToManyField(to='huntserver.Puzzle', blank=True)),
],
),
migrations.CreateModel(
name='Solve',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('puzzle', models.ForeignKey(to='huntserver.Puzzle')),
],
),
migrations.CreateModel(
Expand All @@ -49,26 +72,70 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('submission_time', models.DateTimeField()),
('submission_text', models.CharField(max_length=100)),
('response_text', models.CharField(max_length=400)),
('response_text', models.CharField(max_length=400, blank=True)),
('puzzle', models.ForeignKey(to='huntserver.Puzzle')),
],
),
migrations.CreateModel(
name='Team',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('team_name', models.CharField(max_length=200)),
('location', models.CharField(max_length=80, blank=True)),
('hunt', models.ForeignKey(to='huntserver.Hunt')),
('login_info', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
('solved', models.ManyToManyField(to='huntserver.Puzzle')),
('solved', models.ManyToManyField(related_name='solved_for', through='huntserver.Solve', to='huntserver.Puzzle', blank=True)),
],
),
migrations.CreateModel(
name='Unlock',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('time', models.DateTimeField()),
('puzzle', models.ForeignKey(to='huntserver.Puzzle')),
('team', models.ForeignKey(to='huntserver.Team')),
],
),
migrations.CreateModel(
name='Unlockable',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('content_type', models.CharField(default=b'TXT', max_length=3, choices=[(b'IMG', b'Image'), (b'PDF', b'PDF'), (b'TXT', b'Text'), (b'WEB', b'Link')])),
('content', models.CharField(max_length=500)),
('puzzle', models.ForeignKey(to='huntserver.Puzzle')),
],
),
migrations.AddField(
model_name='team',
name='unlockables',
field=models.ManyToManyField(to='huntserver.Unlockable', blank=True),
),
migrations.AddField(
model_name='team',
name='unlocked',
field=models.ManyToManyField(related_name='unlocked_for', through='huntserver.Unlock', to='huntserver.Puzzle', blank=True),
),
migrations.AddField(
model_name='submission',
name='team',
field=models.ForeignKey(to='huntserver.Team'),
),
migrations.AddField(
model_name='solve',
name='submission',
field=models.ForeignKey(to='huntserver.Submission', blank=True),
),
migrations.AddField(
model_name='solve',
name='team',
field=models.ForeignKey(to='huntserver.Team'),
),
migrations.AddField(
model_name='person',
name='teams',
field=models.ManyToManyField(to='huntserver.Team', blank=True),
),
migrations.AddField(
model_name='message',
name='team',
field=models.ForeignKey(to='huntserver.Team'),
),
Expand Down
19 changes: 0 additions & 19 deletions huntserver/migrations/0002_auto_20150616_1126.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
class Migration(migrations.Migration):

dependencies = [
('huntserver', '0004_auto_20150616_1151'),
('huntserver', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='puzzle',
name='puzzle_number',
name='num_pages',
field=models.IntegerField(default=0),
preserve_default=False,
),
Expand Down
19 changes: 0 additions & 19 deletions huntserver/migrations/0003_auto_20150616_1131.py

This file was deleted.

23 changes: 23 additions & 0 deletions huntserver/migrations/0003_auto_20151226_0710.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('huntserver', '0002_puzzle_num_pages'),
]

operations = [
migrations.RemoveField(
model_name='person',
name='year',
),
migrations.AddField(
model_name='person',
name='andrewid',
field=models.CharField(max_length=8, blank=True),
),
]
24 changes: 0 additions & 24 deletions huntserver/migrations/0004_auto_20150616_1151.py

This file was deleted.

27 changes: 27 additions & 0 deletions huntserver/migrations/0004_auto_20151226_0715.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('huntserver', '0003_auto_20151226_0710'),
]

operations = [
migrations.RenameField(
model_name='person',
old_name='login_info',
new_name='user',
),
migrations.RemoveField(
model_name='person',
name='first_name',
),
migrations.RemoveField(
model_name='person',
name='last_name',
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
class Migration(migrations.Migration):

dependencies = [
('huntserver', '0009_auto_20150701_1118'),
('huntserver', '0004_auto_20151226_0715'),
]

operations = [
migrations.RemoveField(
model_name='team',
name='solved',
model_name='person',
name='email',
),
]
26 changes: 0 additions & 26 deletions huntserver/migrations/0006_auto_20150623_1952.py

This file was deleted.

0 comments on commit 4d64bca

Please sign in to comment.