Skip to content
This repository has been archived by the owner on Dec 23, 2018. It is now read-only.

Split WizardView into WizardMixin, BaseWizardView and WizardView #34

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

dbrgn
Copy link

@dbrgn dbrgn commented Mar 9, 2012

Hello

I started using the django-formwizard for a project where we use a CBV based tab navigation. I need to put a form inside a tab.

Using the current generic views, this works without any problem, by adding the generic FormMixin to my views. But django-formwizard doesn't really work that way.

In Django's generic CBVs, all views are split into a mixin, a baseview and a view. The mixin extends object and contains no rendering logic. The baseview contains the mixin and rendering logic, but no template output. The final view extends the baseview but adds template output.

In django-formwizard, the WizardView extends TemplateView directly though. This can cause multiple inheritance problems, when using the WizardView as a mixin to an existing class.

I tried to add this behavior to django-formwizard. Currently it's just a quick change, for which I'd like to get some feedback. The changes don't break any existing code. In case other people think this is a good change, I'd add some documentation to it.

One thing that doesn't worke nicely, but can't be fixed without breaking existing code, is the get_context_data method. All builtin generic views only accept self, **kwargs as arguments, but django-formwizard accepts self, form, *args, **kwargs as arguments. This means that any standard-conform mixins on top of the formwizard break it.

What do you think about those changes? Can they be improved further? Would you provide baseviews for all view extensions like the SessionWizardView?

If the changes look good, I'll probably file them as a bug request in the Django bugtracker after some improvements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants