Projet

Général

Profil

Development #10526

Allow display of plugin frontends for quick account creation on the registration page.

Ajouté par Mikaël Ates il y a environ 8 ans. Mis à jour il y a presque 8 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
-
Début:
01 avril 2016
Echéance:
% réalisé:

100%

Temps estimé:
Patch proposed:
Oui
Planning:

Fichiers

Révisions associées

Révision 99b0693e (diff)
Ajouté par Mikaël Ates il y a environ 8 ans

Add frontends from backends and plugins to the registration page (fixes #10526).

Historique

#1

Mis à jour par Mikaël Ates il y a environ 8 ans

  • Fichier 0001-Add-frontends-from-backends-and-plugins-to-the-regit.patch ajouté
  • Patch proposed changé de Non à Oui
#2

Mis à jour par Mikaël Ates il y a environ 8 ans

This patch is a first proposition.

I get some trouble to use this with the context and add_to_blocks : the css from the plugin is not added. My code in the FC plugin is the folowing:

    def registration_frontend(self, request, *args, **kwargs):
        if 'fc-user_info' in request.session:
            return []
        tpl_parameters = {'about_url': app_settings.about_url}
        tpl_parameters['autocreate'] = True
        context_instance = RequestContext(request)
        if django.VERSION >= (1, 8, 0):
            context_instance['add_to_blocks'] = collections.defaultdict(lambda: [])
        return render(request, 'authentic2_auth_fc/login.html',
                      tpl_parameters, context_instance=context_instance)

#3

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Ok, pour passer les blocks au template plus haut il faut que tous les templates partage le même contexte de rendu qui doit contenir une variable add_to_blocks qui est un dico (en Django 1.8 ça ne marche plus tout seul à cause d'un changement dans le chargement des processeurs de contextes d'où le if django.VERSIO >= (1, 8, 0):)

Alors le flot des vues basées sur les classes:

View.get() -> render_to_response(self.get_context_data())
View.post() -> View.form_invalid() -> render_to_response(self.get_context_data())

donc je réécrirai get_context_data comme ceci:

    def get_context_data(self, **kwargs):
        ctx = super(RegistrationView, self).get_context_data(**kwargs)
        request_context = RequestContext(self.request)
        request_context.push(ctx)
        if django.VERSION >= (1, 8, 0):
            request_context['add_to_blocks'] = collections.defaultdict(lambda: [])
        registration_frontends = utils.accumulate_from_backends(self.request, 'registration_frontend', context_instance=request_context)
        request_context['registration_frontends'] = registration_frontends
        return request_context

coté #10621 il n'y a plus qu'à récupérer context_instance depuis les **kwargs.

#4

Mis à jour par Mikaël Ates il y a environ 8 ans

  • Fichier 0001-Add-frontends-from-backends-and-plugins-to-the-regis.patch ajouté
#5

Mis à jour par Mikaël Ates il y a environ 8 ans

  • Fichier 0001-Add-frontends-from-backends-and-plugins-to-the-regit.patch supprimé
#7

Mis à jour par Mikaël Ates il y a environ 8 ans

  • Fichier 0001-Add-frontends-from-backends-and-plugins-to-the-regis.patch supprimé
#8

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Ack.

#9

Mis à jour par Mikaël Ates il y a environ 8 ans

  • Statut changé de Nouveau à Résolu (à déployer)
  • % réalisé changé de 0 à 100
#10

Mis à jour par Mikaël Ates il y a presque 8 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF