Skip to content

Commit

Permalink
More minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Jan 9, 2016
1 parent 4d64bca commit e246b41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion huntserver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Person(models.Model):
is_andrew_acct = models.BooleanField()

def __unicode__(self):
return self.first_name + " " + self.last_name
return self.user.first_name + " " + self.user.last_name

class Submission(models.Model):
team = models.ForeignKey(Team)
Expand Down
9 changes: 6 additions & 3 deletions huntserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def login_selection(request):
def hunt(request, hunt_num):
hunt = get_object_or_404(Hunt, hunt_number=hunt_num)
team = team_from_user_hunt(request.user, hunt)

# Admins get all access, wrong teams/early lookers get an error page
# real teams get appropriate puzzles, and puzzles from past hunts are public
if(request.user.is_staff):
Expand All @@ -109,8 +109,11 @@ def hunt(request, hunt_num):
return render(request, 'access_error.html')

puzzles = sorted(puzzle_list, key=lambda p: p.puzzle_number)

context = {'puzzles': puzzles, 'team': team, 'solved': team.solved.all()}
if(team == None):
solved = []
else:
solved = team.solved.all()
context = {'puzzles': puzzles, 'team': team, 'solved': solved}

# Each hunt should have a main template named hunt#.html (ex: hunt3.html)
return render(request, 'hunt' + str(hunt_num) + '.html', context)
Expand Down
1 change: 0 additions & 1 deletion puzzlehunt_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
'django.contrib.staticfiles',
'huntserver',
'ws4redis',
'debug_toolbar',
)

MIDDLEWARE_CLASSES = (
Expand Down

0 comments on commit e246b41

Please sign in to comment.