question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support form wizard

See original GitHub issue

Hi,

It would be nice if django-crispy-forms could handle form wizards this way :

{% crispy wizard helper %}

Thanks for this great lib!

Olivier

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
yekibudcommented, Aug 11, 2013

Here’s some code:

class WizardButton(StrictButton):

    def __init__(self, content, **kwargs):
        kwargs.setdefault('type', 'submit')
        super(WizardButton, self).__init__(content, **kwargs)


class PrevButton(WizardButton):
    step = 'prev'

    def __init__(self, content, **kwargs):
        kwargs['name'] = 'wizard_goto_step'
        super(PrevButton, self).__init__(content, **kwargs)


class NextButton(WizardButton):
    step = 'next'


class FinishButton(WizardButton):
    step = 'finish'


class WizardNavigation(ButtonHolder):
    """
    Layout object for rendering form wizard Previous, Next and Finish buttons::

        Button("button content", css_class="extra")
        WizardNavigation(
            PrevButton('Previous'), NextButton('Next'), FinishButton('Finish')
        )
    """
    template = '%s/layout/wizard_navigation.html' % TEMPLATE_PACK

    def render(self, form, form_style, context, template_pack=TEMPLATE_PACK):
        buttons = {'extra': []} 
        for field in self.fields:
            if getattr(field, 'step', None) == 'prev': 
                buttons['prev'] = field
            elif getattr(field, 'step', None) == 'next': 
                buttons['next'] = field
            elif getattr(field, 'step', None) == 'finish': 
                buttons['finish'] = field
            else:
                buttons['extra'].append(field)

        return render_to_string(
            self.template, 
            Context({
                'buttonholder': self,
                'buttons': buttons,
                'wizard': context['wizard'],
            }),
        )

0reactions
carltongibsoncommented, Feb 21, 2017

I’m going to close this as Out of Scope for the moment. Happy to consider documented, tested pull requests. We may have capacity to reconsider in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a form by using the Form Wizard
On the Create tab, in the Forms group, click Form Wizard. Follow the directions on the pages of the Form Wizard. Note: If...
Read more >
Form wizard — django-formtools 2.4.post2 documentation
The form wizard application splits forms across multiple Web pages. ... For example, let's write a “contact form” wizard, where the first page's...
Read more >
Contact Us at Forms Wizard
Sales Team: Contact us Forms-Wizard +972-54-4854733 sales@forms-wizard.com ; Support Team: Contact us Forms-Wizard +972-51-2245833 support@forms-wizard.com.
Read more >
Form wizard
Form wizard · 1-, Give your form a name, description (not required) and form direction (RTL or LTR) · 2-, Add elements by...
Read more >
Forms
See our Child Support and Alimony webpage for more information. Uniformed Services Former Spouses' Protection Act. DD2293 Wizard* Form
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found