-def user_register(request):
- if request.method == 'POST':
- form = RegisterUserForm(request.POST) # Nous reprenons les données
- if form.is_valid():
- first_name = form.cleaned_data['first_name']
- last_name = form.cleaned_data['last_name']
- email = form.cleaned_data['email']
- password = form.cleaned_data['password']
- password2 = form.cleaned_data['password2']
- keypair = form.cleaned_data['keypair']
- ## Ici nous pouvons traiter les données du formulaire
- #sujet = form.cleaned_data['sujet']
- #message = form.cleaned_data['message']
- #envoyeur = form.cleaned_data['envoyeur']
- #renvoi = form.cleaned_data['renvoi']
- ## Nous pourrions ici envoyer l'e-mail grâce aux données que nous venons de récupérer
- #envoi = True
- else:
- form = RegisterUserForm()
- return render(request, 'register_user.html', locals())
- pass
+class DashboardView(TemplateView):
+ template_name = "dashboard.html"
+
+ def get_context_data(self, **kwargs):
+ user_hrn = 'ple.upmc.jordan_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')
+ auth_query = Query().get('network').select('network_hrn')
+ page.enqueue_query(slice_query)
+ page.enqueue_query(auth_query)
+
+ page.expose_queries()
+
+ slicelist = SimpleList(
+ title = None,
+ page = page,
+ key = 'slice.slice_hrn',
+ query = slice_query,
+ )
+
+ authlist = SimpleList(
+ title = None,
+ page = page,
+ key = 'network_hrn',
+ query = auth_query,
+ )
+
+ context = super(DashboardView, self).get_context_data(**kwargs)
+ context['person'] = self.request.user
+ context['networks'] = authlist.render(self.request)
+ context['slices'] = slicelist.render(self.request)
+
+ # XXX This is repeated in all pages
+ # 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)
+ # so we can sho who is logged
+ context['username'] = the_user(self.request)
+
+ context.update(page.prelude_env())
+
+ return context
+
+class UserRegisterView(RegistrationView):
+ """
+ A registration backend which follows a simple workflow:
+
+ 1. User signs up, inactive account is created.
+
+ 2. Email is sent to user with activation link.
+
+ 3. User clicks activation link, account is now active.
+
+ Using this backend requires that
+
+ * ``registration`` be listed in the ``INSTALLED_APPS`` setting
+ (since this backend makes use of models defined in this
+ application).
+
+ * The setting ``ACCOUNT_ACTIVATION_DAYS`` be supplied, specifying
+ (as an integer) the number of days from registration during
+ which a user may activate their account (after that period
+ expires, activation will be disallowed).
+
+ * The creation of the templates
+ ``registration/activation_email_subject.txt`` and
+ ``registration/activation_email.txt``, which will be used for
+ the activation email. See the notes for this backends
+ ``register`` method for details regarding these templates.
+
+ Additionally, registration can be temporarily closed by adding the
+ setting ``REGISTRATION_OPEN`` and setting it to
+ ``False``. Omitting this setting, or setting it to ``True``, will
+ be interpreted as meaning that registration is currently open and
+ permitted.
+
+ Internally, this is accomplished via storing an activation key in
+ an instance of ``registration.models.RegistrationProfile``. See
+ that model and its custom manager for full documentation of its
+ fields and supported operations.
+
+ """
+ form_class = UserRegisterForm
+
+ def register(self, request, **cleaned_data):
+ """
+ Given a username, email address and password, register a new
+ user account, which will initially be inactive.