Permalink
Browse files

Now we only redirect to the application form if the challenge is open…

…. Added bonus we also only say - submit a game if the challenge is open when you have any empty profile
  • Loading branch information...
1 parent 36ddabc commit 44a2488803096e37796a6f80c65a39b021421b70 @rossbruniges committed Dec 6, 2012
Showing with 14 additions and 4 deletions.
  1. +7 −1 gameon/users/templates/users/profile.html
  2. +7 −3 gameon/users/views.py
View
8 gameon/users/templates/users/profile.html
@@ -44,7 +44,13 @@ <h1 class="busta shout">{{ profile.display_name }}</h1>
</ol>
{% else %}
<h2 class="announce">No entries yet</h2>
- <p>Feels like now is a great time to <a class="cta" href="{{ url('submissions.create_entry') }}">submit a game</a></p>
+ {% if request.challenge %}
+ {% if request.challenge.is_open() %}
+ <p>Feels like now is a great time to <a class="cta" href="{{ url('submissions.create_entry') }}">submit a game</a></p>
+ {% else %}
+ <p>While you wait for submissions to open ({{ request.challenge.start_date.strftime('%B %e, %Y') }}) have a look through the site, you've got some time to plan your game!</p>
+ {% endif %}
+ {% endif %}
{% endif %}
</div>
</div>
View
10 gameon/users/views.py
@@ -51,10 +51,14 @@ def edit(request, template='users/profile_edit.html'):
else:
"""
The only reason anyone will want to create an account is to
- submit a game, so take them right there
+ submit a game, so take them right there, if it's open
"""
- messages.success(request, _('<strong>Profile created.</strong> Now you can submit your first game!'))
- return redirect(reverse('submissions.create_entry'))
+ if request.challenge.is_open():
+ messages.success(request, _('<strong>Profile created.</strong> Now you can submit your first game!'))
+ return redirect(reverse('submissions.create_entry'))
+ else:
+ messages.success(request, _('<strong>Profile created.</strong>'))
+ return redirect(profile)
else:
form = form_class(instance=profile)
return render(request, template, {

0 comments on commit 44a2488

Please sign in to comment.