2017-08-18 15:46:51 +00:00
|
|
|
from django.conf import settings
|
2017-10-02 23:29:40 +00:00
|
|
|
from django.contrib import messages
|
2017-08-17 16:20:18 +00:00
|
|
|
from django.http import HttpResponseServerError
|
2017-10-02 23:29:40 +00:00
|
|
|
from django.shortcuts import redirect, render
|
2017-08-17 16:20:18 +00:00
|
|
|
from django.template import RequestContext
|
|
|
|
from django.template import Template
|
|
|
|
from django.template.loader import get_template
|
|
|
|
from django.views import defaults
|
|
|
|
|
2017-08-18 15:46:51 +00:00
|
|
|
from account.forms import LoginEmailForm, LoginUsernameForm, SignupForm
|
2017-08-18 16:26:35 +00:00
|
|
|
from account.views import LoginView
|
2017-08-18 15:46:51 +00:00
|
|
|
|
2017-08-17 16:20:18 +00:00
|
|
|
def server_error(request, template_name=defaults.ERROR_500_TEMPLATE_NAME):
|
|
|
|
t = Template("{%% include '%s' %%}" % template_name)
|
|
|
|
return HttpResponseServerError(t.render(RequestContext(request)))
|
2017-08-18 15:46:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
def account_login(request):
|
|
|
|
|
|
|
|
d = {
|
2017-08-18 16:26:35 +00:00
|
|
|
"login_form": LoginEmailForm(),
|
2017-08-18 15:46:51 +00:00
|
|
|
"signup_form": SignupForm(),
|
|
|
|
"signup_open": getattr(settings, "ACCOUNT_OPEN_SIGNUP", True),
|
|
|
|
}
|
|
|
|
|
|
|
|
print d["signup_open"], settings.ACCOUNT_OPEN_SIGNUP
|
|
|
|
return render(request, "account_login.html", d)
|
2017-08-18 16:26:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EmailLoginView(LoginView):
|
|
|
|
form_class = LoginEmailForm
|
2017-10-02 23:29:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
def buy_ticket(request):
|
|
|
|
|
|
|
|
print(dir(request.user))
|
|
|
|
if not request.user.is_authenticated():
|
2017-10-10 01:37:31 +00:00
|
|
|
messages.warning(request,
|
|
|
|
'''To buy a ticket, either create an account, or log in.
|
|
|
|
Attendees should fill out their own registration.
|
|
|
|
You will receive a payment link that you can pass to accounts
|
|
|
|
staff, if required. ''')
|
2017-10-02 23:29:40 +00:00
|
|
|
|
|
|
|
return redirect("/dashboard")
|