Hi
I've been using the form wizard for an convention sign-up application.
I felt that the FormWizard is strange. It's not a form class, neither
a view function but something inbetween. I'm going to EuroPython and
wonder if anyone out there would like to join me for a FormWizard-
rewrite-sprint? My suggestion is to rewrite the FormWizard class so
the form validation stuff happens inside the FormWizard instance and
anything view-ish happens in a ordinary view class. This would
eliminate some of the hacks I had to do and make using the FormWizard
easier, I believe. An example:

#forms.py

class MyFormWizard(FormWizard):
    """Subclass of the new, simplified FormWizard"""
    forms=[Form01,Form02]

#views.py
def event_registration(request,event_id):
    """A simple view for signing up to an event"""
    event=Event.objects.get(id=event_id)
    if event.registration_is_open():
        wizard=MyFormWizard(request)
        if MyFormWizard.done:
            #do some registration stuff
            #saving etc
            return HttpResponseRedirect("/sign_up/thank_you/")
        else:
            #we're not done yet
            current_form=MyFormWizard.get_current_form()
            prev_forms=MyFormWizard.get_prev_forms()
            step=MyFormWizard.current_step
            #etc
            return render_to_response(template_name,
{"current_form":current_form}) #etc
    else:
        return HttpResponseRedirect("/sign_up/event_closed/")
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to