django-formwizard

Django formtools done function not executed

回眸只為那壹抹淺笑 提交于 2019-12-11 14:52:27
问题 I am trying to implement the formwizard in django. The steps work as expected, but aftet the final form (second step) is submitted, the done function is not hit. I am not able to find the reason why. Kindly direct. Following is my code, Forms.py from django import forms class FormStepOne(forms.Form): name = forms.CharField(max_length=100) last_name = forms.CharField(max_length=100) phone = forms.CharField(max_length=100) email = forms.EmailField() class FormStepTwo(forms.Form): otp = forms

How to save files using django form wizard?

坚强是说给别人听的谎言 提交于 2019-12-11 14:02:01
问题 How to save files using django form wizard? I use Django 1.3 and i can't find examples and solutions. ;-/ With google and django docs i wrote this: class ContactWizard(FormWizard): def done(self, request, form_list): d = dict((k, v) for form in form_list for k, v in form.cleaned_data.items()) d['ip'] = request.META.get('REMOTE_ADDR') d['password'] = hashlib.sha1(d['password']) db = Ads(**d) db.save() return HttpResponseRedirect('/') OK, this save all POST data. But files? I can catch them

Django Form Wizard with Jquery steps

ⅰ亾dé卋堺 提交于 2019-12-11 11:40:20
问题 How would one get Django forms wizard to work with Jquery steps (http://www.jquery-steps.com/Examples#tabs)? Would I have to manually write out the html instead of using Django form? Sorry I know this a very vague and general question but I just need some ideas to attack this problem. Thanks 回答1: You can make tabs with absolute link, without jquery, that is easy solution. On every step(new page) you can make new form.. Or other solution, to make 1 form, then on each tab, generate only fields

Django Form Wizard with Conditional Questions

左心房为你撑大大i 提交于 2019-12-10 21:47:12
问题 In my Django application, I currently have a form wizard with a few form classes. I would like to have the ability to have conditional questions. Meaning if the user selects yes for a certain question, another question within the form will become required and javascript will make the question visible. I found an example of how to do this online, however it doesn't work. Any suggestions on how I can create this functionality? class QuestionForm(forms.Form): COOL_LIST = ( ('cool','Cool'), (

Django Formwizard with dynamic form does not proceed to next step

*爱你&永不变心* 提交于 2019-12-08 05:01:30
I am trying to create a django formwizard where the first form has a choicefield generated at runtime. I can generate the form with the correct choices but when I click submit the formwizard does not proceed to the next step. It submits the form but returns to form1. Here are my forms and view ##Forms class EventForm1(forms.Form): def __init__(self, *args, **kwargs): ##Get choices at runtime choices = kwargs.pop('loan_choices', []) super(EventForm1, self).__init__(*args, **kwargs) self.fields['loan'] = forms.ChoiceField(choices=choices, required=False, widget=forms.Select(attrs={'class':

How wrap a FormWizard in a View?

流过昼夜 提交于 2019-12-07 16:27:08
问题 How do I wrap a Django Form Wizard in a view? I need to do this so I can access request . Does anyone have some example code for this? 回答1: I probably should be just commenting on Manoj's answer, but sounds you need code urls.py from django.conf.urls.defaults import * from MyApp import views urlpatterns = patterns( '', (r'^wizard/$', views.MyWizardView ), ) views.py @login_required def MyWizardView (request): cw = MyWizard([WizardName, WizardQuestions, WizardProvider, WizardGoomber]) return

Django: Saving Foreign Key from Form

两盒软妹~` 提交于 2019-12-07 01:32:34
This is a continuation of this question in which I am trying to figure out how to construct a PointField composed of lat / lon FloatFields. I have taken @Simon's advice and restructured my model to look like this: class Point(models.Model): lat = models.FloatField() lon = models.FloatField() class Thing(models.Model): point = models.ForeignKey(Point) My form has two fields corresponding to values from google maps' longitude and latitude coordinates: class StepThreeForm(forms.Form): lat = forms.FloatField() lon = forms.FloatField() ... However, this does not work for obvious reasons, but I am

Django-Oscar Basket customization

六月ゝ 毕业季﹏ 提交于 2019-12-06 06:22:15
问题 I am using Djnago-oscar for Solar energy equipment based eCommerce site. I need to add an option to "Basket" model with "Battery Name", "Notes" and "Manufacturer". There is a reason I don't want to add it in subclass AbstractProduct. Rather I want to built it with subclass Basket model. Now I need help to understand my workflow to make this work with AddToBasket form. In Django-oscar/basket there are formsets.py using formset factory and a form. I am a bit confused and decided to get help

Empty ModelFormset in Django's FormWizard

陌路散爱 提交于 2019-12-06 04:45:22
问题 I'm using Django's FormWizard. It works fine but I'm having trouble getting any empty model formset to display correctly. I have a model called Domain . I'm creating a ModelFormset like this: DomainFormset = modelformset_factory(Domain) I pass this to the FormWizard like this: BuyNowWizardView.as_view([DomainFormset]) I don't get any errors but when the wizard renders the page, I get a list of all Domain objects. I'd like to get an empty form. How I can do this? I've read that I can give a

How wrap a FormWizard in a View?

浪尽此生 提交于 2019-12-05 19:05:51
How do I wrap a Django Form Wizard in a view? I need to do this so I can access request . Does anyone have some example code for this? I probably should be just commenting on Manoj's answer, but sounds you need code urls.py from django.conf.urls.defaults import * from MyApp import views urlpatterns = patterns( '', (r'^wizard/$', views.MyWizardView ), ) views.py @login_required def MyWizardView (request): cw = MyWizard([WizardName, WizardQuestions, WizardProvider, WizardGoomber]) return cw(request) bikeshedder The as_view function converts a class based view into a callable view: from django