Merge pull request #66 from lca2017/chrisjrn/session_chair

Chrisjrn/session chair
This commit is contained in:
Scott Bragg 2017-01-10 21:30:57 +11:00 committed by GitHub
commit 6458f4d436
2 changed files with 8 additions and 2 deletions

View file

@ -270,6 +270,12 @@ class Session(models.Model):
else:
return None
def chair(self):
for role in self.sessionrole_set.all():
if role.role == SessionRole.SESSION_ROLE_CHAIR:
return role
return None
def __str__(self):
start = self.start()
end = self.end()

View file

@ -350,8 +350,8 @@ def session_detail(request, session_id):
runner_denied = True
if request.method == "POST" and request.user.is_authenticated():
if not hasattr(request.user, "profile") or not request.user.profile.is_complete:
response = redirect("profile_edit")
if not hasattr(request.user, "attendee") or not request.user.attendee.completed_registration:
response = redirect("guided_registration")
response["Location"] += "?next=%s" % request.path
return response