4 from django.utils.datastructures import MultiValueDictKeyError |
4 from django.utils.datastructures import MultiValueDictKeyError |
5 |
5 |
6 from django.contrib.auth import authenticate, login, logout |
6 from django.contrib.auth import authenticate, login, logout |
7 |
7 |
8 from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo |
8 from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo |
9 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm, ParticipantInfoForm, SendAccoForm |
9 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm, ParticipantInfoForm, SendAccoForm, EditAddressForm |
10 from sage_days.sdi.events import send_reg_complete_mail, mail_invi, send_sgd_ptc_confirm, send_cnf_email, send_wsp_ptc_confirm, send_acco_confirm_mail |
10 from sage_days.sdi.events import send_reg_complete_mail, mail_invi, send_sgd_ptc_confirm, send_cnf_email, send_wsp_ptc_confirm, send_acco_confirm_mail |
11 from sage_days.settings import APACHE_URL_PREFIX as aup |
11 from sage_days.settings import APACHE_URL_PREFIX as aup |
12 |
12 |
13 def register(request): |
13 def register(request): |
14 """ The user register page. |
14 """ The user register page. |
256 |
256 |
257 return render_to_response("attending_sgd.html", {"user":user}) |
257 return render_to_response("attending_sgd.html", {"user":user}) |
258 else: |
258 else: |
259 return render_to_response("cnf_sgd_ptc.html", {"user":user}) |
259 return render_to_response("cnf_sgd_ptc.html", {"user":user}) |
260 |
260 |
|
261 def confirm_address(request, uid): |
|
262 """ match id versus email and let him edit the address |
|
263 """ |
|
264 |
|
265 try: |
|
266 email = request.GET['email'] |
|
267 except MultiValueDictKeyError: |
|
268 raise Http404 |
|
269 |
|
270 try: |
|
271 user = Registrant.objects.get(id=uid, email=email) |
|
272 except Registrant.DoesNotExist: |
|
273 raise Http404 |
|
274 |
|
275 form = EditAddressForm(request.POST, instance=user) |
|
276 if request.method == "POST" and form.is_valid(): |
|
277 form.save() |
|
278 |
|
279 send_addr_upd_email(user) |
|
280 |
|
281 return render_to_response("address_updated.html", {"user":user}) |
|
282 else: |
|
283 return render_to_response("update_address.html", {"user":user}) |
|
284 |
261 def admin_login(request): |
285 def admin_login(request): |
262 """ basic login. |
286 """ basic login. |
263 """ |
287 """ |
264 |
288 |
265 redirect_url = "/%s/registration/stats"%aup |
289 redirect_url = "/%s/registration/stats"%aup |