def get_context_data(self, **kwargs):
user_hrn = 'ple.upmc.jordan_auge'
+ #user_hrn = 'iotlab.auge'
#messages.info(self.request, 'You have logged in')
page = Page(self.request)
# Slow...
#slice_query = Query().get('slice').filter_by('user.user_hrn', 'contains', user_hrn).select('slice_hrn')
- slice_query = Query().get('user').filter_by('user_hrn', '==', user_hrn).select('slice.slice_hrn')
+ slice_query = Query().get('user').filter_by('user_hrn', '==', user_hrn).select('user_hrn', 'slice.slice_hrn')
auth_query = Query().get('network').select('network_hrn')
page.enqueue_query(slice_query)
page.enqueue_query(auth_query)
# more general variables expected in the template
context['title'] = 'Test view that combines various plugins'
# the menu items on the top
- context['topmenu_items'] = topmenu_items('dashboard', self.request)
+ context['topmenu_items'] = topmenu_items('Dashboard', self.request)
# so we can sho who is logged
context['username'] = the_user(self.request)
request=request)
return new_user
+ def get_context_data(self, **kwargs):
+ context = super(UserRegisterView, self).get_context_data(**kwargs)
+ context['topmenu_items'] = topmenu_items('Register', self.request)
+ context['username'] = the_user (self.request)
+ return context
+
def registration_allowed(self, request):
"""
Indicate whether account registration is currently permitted,
affiliation = form.cleaned_data['affiliation']
subject = form.cleaned_data['subject']
message = form.cleaned_data['message']
- email = form.cleaned_data['email']
+ email = form.cleaned_data['email'] # email of the sender
cc_myself = form.cleaned_data['cc_myself']
recipients = ['yasin.upmc@gmail.com']
if cc_myself:
- recipients.append(sender)
+ recipients.append(email)
from django.core.mail import send_mail
- send_mail(subject, message, email, recipients)
+ send_mail("Onelab user submitted a query ", [first_name,last_name,affiliation,subject,message], email, recipients)
return render(request,'contact_sent.html') # Redirect after POST
else:
form = ContactForm() # An unbound form
'form': form,
})
+
+def slice_request(request):
+ if request.method == 'POST': # If the form has been submitted...
+ form = SliceRequestForm(request.POST) # A form bound to the POST data
+ if form.is_valid(): # All validation rules pass
+ # Process the data in form.cleaned_data
+ slice_name = form.cleaned_data['slice_name']
+ number_of_nodes = form.cleaned_data['number_of_nodes']
+ type_of_nodes = form.cleaned_data['type_of_nodes']
+ purpose = form.cleaned_data['purpose']
+ email = form.cleaned_data['email'] # email of the sender
+ cc_myself = form.cleaned_data['cc_myself']
+
+ recipients = ['yasin.upmc@gmail.com','jordan.auge@lip6.fr']
+ if cc_myself:
+ recipients.append(email)
+
+ from django.core.mail import send_mail
+ send_mail("Onelab New Slice request form submitted", [slice_name,number_of_nodes,type_of_nodes,purpose], email, recipients)
+ return render(request,'slicereq_recvd.html') # Redirect after POST
+ else:
+ form = SliceRequestForm() # An unbound form
+
+# template_env = {}
+# template_env['form'] = form
+# template_env['topmenu_items'] = topmenu_items('Request a slice', request)
+# template_env['unfold1_main'] = render(request, 'slice_request_.html', {
+# 'form': form,
+# })
+# from django.shortcuts import render_to_response
+# from django.template import RequestContext
+# return render_to_response ('view-unfold1.html',template_env,
+# context_instance=RequestContext(request))
+
+ return render(request, 'slice_request.html', {
+ 'form': form,
+ 'topmenu_items': topmenu_items('Request a slice', request),
+ 'username': the_user (request)
+ })
+