Adds special login link for buy_tickets that displays an message

This commit is contained in:
Christopher Neugebauer 2017-10-02 16:29:40 -07:00
parent 89a0af0d88
commit 41ba224759
3 changed files with 14 additions and 3 deletions

View file

@ -20,7 +20,7 @@
<br />
<div class="pull-right"><a class="btn btn-lg btn-primary" href="/dashboard">Buy a Ticket</a></div>
<div class="pull-right"><a class="btn btn-lg btn-primary" href="/tickets/buy">Buy a Ticket</a></div>
<h2>Which Ticket?</h2>
<p><em>Early Bird discounts are available for the first 100 tickets sold, or until October 20, whichever comes first. T-shirts are only available for tickets bought before November 7.</em></p>
@ -101,7 +101,7 @@
<p>If you cant afford to attend on these prices, please email <a href="mailto:spam@northbaypthon.org">spam@northbaypython.org</a> well enthusiastically waive ticket fees for people who need it.</em></p>
<div class="btn-group">
<a class="btn btn-lg btn-primary" href="/dashboard">Buy a Ticket</a>
<a class="btn btn-lg btn-primary" href="/tickets/buy">Buy a Ticket</a>
</div>

View file

@ -31,6 +31,7 @@ urlpatterns = [
# attend
url(r"^attend$", TemplateView.as_view(template_name="static_pages/attend/attend.html"), name="attend/attend"),
url(r"^tickets$", RedirectView.as_view(url="attend")),
url(r"^tickets/buy$", views.buy_ticket, name="buy_ticket"),
url(r"^attend/business-case$", TemplateView.as_view(template_name="static_pages/attend/business-case.html"), name="attend/business-case"),
url(r"^attend/travel$", TemplateView.as_view(template_name="static_pages/attend/travel.html"), name="attend/travel"),
url(r"^attend/hotels$", TemplateView.as_view(template_name="static_pages/attend/hotels.html"), name="attend/hotels"),

View file

@ -1,6 +1,7 @@
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseServerError
from django.shortcuts import render
from django.shortcuts import redirect, render
from django.template import RequestContext
from django.template import Template
from django.template.loader import get_template
@ -28,3 +29,12 @@ def account_login(request):
class EmailLoginView(LoginView):
form_class = LoginEmailForm
def buy_ticket(request):
print(dir(request.user))
if not request.user.is_authenticated():
messages.warning(request, 'To buy a ticket, either create an account, or log in.')
return redirect("/dashboard")