X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fregistrationview.py;h=9867c3614bf7419411bb1b465deb2e87d89159e9;hb=4dfd873aec658a5f2a22983c7221f8b7006aa475;hp=e85d44ffc81ea8d748fc20516f2a841a187a896a;hpb=1aea42c3668602aacfe22bc762ee939672129f53;p=unfold.git diff --git a/portal/registrationview.py b/portal/registrationview.py index e85d44ff..9867c361 100644 --- a/portal/registrationview.py +++ b/portal/registrationview.py @@ -1,6 +1,6 @@ import os.path, re -from django.core.mail import send_mail +from django.core.mail import send_mail from django.views.generic import View from django.template.loader import render_to_string @@ -11,6 +11,9 @@ from myslice.viewutils import topmenu_items from manifold.manifoldapi import execute_query from manifold.core.query import Query +from portal.models import PendingUser +from portal.actions import authority_get_pi_emails + # This is a rough porting from views.py # the former function-based view is now made a class # we redefine dispatch as it is simple @@ -25,9 +28,10 @@ class RegistrationView (View): errors = [] - authorities_query = Query.get('authority').filter_by('authority_hrn', 'included', ['ple.inria', 'ple.upmc']).select('name', 'authority_hrn') - #authorities_query = Query.get('authority').select('authority_hrn') + #authorities_query = Query.get('authority').filter_by('authority_hrn', 'included', ['ple.inria', 'ple.upmc']).select('name', 'authority_hrn') + authorities_query = Query.get('authority').select('authority_hrn') authorities = execute_query(request, authorities_query) + authorities = sorted(authorities) if request.method == 'POST': # We shall use a form here @@ -102,21 +106,20 @@ class RegistrationView (View): # Send email ctx = { - first_name : reg_fname, - last_name : reg_lname, - #affiliation : reg_aff, - authority_hrn: reg_auth, - email : reg_email, - keypair : keypair, - cc_myself : True # form.cleaned_data['cc_myself'] + 'first_name' : reg_fname, + 'last_name' : reg_lname, + 'authority_hrn': reg_auth, + 'email' : reg_email, + 'keypair' : keypair, + 'cc_myself' : True # form.cleaned_data['cc_myself'] } - recipients = authority_get_pi_emails(authority_hrn) + recipients = authority_get_pi_emails(request,reg_auth) if ctx['cc_myself']: recipients.append(ctx['email']) msg = render_to_string('user_request_email.txt', ctx) - send_mail("Onelab New User request for %s submitted"%email, msg, email, recipients) + send_mail("Onelab New User request for %s submitted"%reg_email, msg, reg_email, recipients) return render(request, 'user_register_complete.html') @@ -129,5 +132,5 @@ class RegistrationView (View): 'authority_hrn': request.POST.get('authority_hrn', ''), 'email': request.POST.get('email', ''), 'password': request.POST.get('password', ''), - 'authorities': authorities + 'authorities': authorities, })