Development #10526
Allow display of plugin frontends for quick account creation on the registration page.
100%
Fichiers
Révisions associées
Historique
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
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)
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.
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é
Mis à jour par Mikaël Ates il y a environ 8 ans
- Fichier
0001-Add-frontends-from-backends-and-plugins-to-the-regit.patchsupprimé
Mis à jour par Mikaël Ates il y a environ 8 ans
Mis à jour par Mikaël Ates il y a environ 8 ans
- Fichier
0001-Add-frontends-from-backends-and-plugins-to-the-regis.patchsupprimé
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
Appliqué par commit authentic2|99b0693eea1f7c2182a2d3cbed500b06b294ac3b.
Add frontends from backends and plugins to the registration page (fixes #10526).