formwizard

Django FormWizard and view

时间秒杀一切 提交于 2019-12-08 04:09:14
问题 Basically, I just want to be able to get the parameter community_name, can this be done with (r'^(?P<community_name>\w+)/matches/submit/$', MatchWizard([MatchStep1Form, MatchStep2Form, MatchStep3Form])), or do I need a view? If I have a view, I can have the URLConf like (r'^(?P<community_name>\w+)/matches/submit/$', "matches.views.submit_form"), and do the normal view procedure, def submit_form(request, community_name): Any idea? Thanks 回答1: posting the solution I found out. After taking a

Django form wizard save and go to previous step

邮差的信 提交于 2019-12-05 04:31:15
问题 I have a working django formwizard which when I hit the previous button doesn't validate the current input. I've tried variations on <input name="wizard_goto_step" class="btn btn-primary btn-large" type="submit" value="prev"/> and <button class="btn btn-info btn-large" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}"> {% trans "prev step" %} </button> but neither of these seems to do what I want to do. 回答1: If you want it to validate and save the data on the current form

Django-formwizard and ModelFormSet save

安稳与你 提交于 2019-12-04 20:24:48
I am rewriting a big piece of our application which requires a user to create a Project with Rewards attached to it. The form is broken into different steps, the first two are the normal Project , the next one is the Rewards , and then lastly a simple preview that lets the user flick back and forth to create a perfect Project . my forms.py class BaseRewardFormSet(BaseModelFormSet): def __init__(self, *args, **kwargs): super(BaseRewardFormSet, self).__init__(*args, **kwargs) self.queryset = Reward.objects.none() RewardFormSet1 = modelformset_factory(Reward, extra=2, exclude=('project'), formset

Easiest way to save Django´s formwizard form_list in DB?

夙愿已清 提交于 2019-12-04 15:03:21
问题 I have created multiple sub-forms from one model to use the FormWizard in Django. Confusing is the saving part. Once the user finished the form, I wanted to save the information in the DB. This is fairly simply with one form, where I can say one_form_from_model.save() But could I do it when I get a form_list returned. I read some postings but they did not make any sense to me. Can I clean the data form.cleaned_data for form in form_list] and then go through every form? But then I would need

Django form wizard save and go to previous step

十年热恋 提交于 2019-12-03 22:12:53
I have a working django formwizard which when I hit the previous button doesn't validate the current input. I've tried variations on <input name="wizard_goto_step" class="btn btn-primary btn-large" type="submit" value="prev"/> and <button class="btn btn-info btn-large" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}"> {% trans "prev step" %} </button> but neither of these seems to do what I want to do. If you want it to validate and save the data on the current form before stepping back to a previous form, you need to override the post() method in your subclass of

Django FormWizard with dynamic forms

ε祈祈猫儿з 提交于 2019-12-03 09:59:23
问题 I want to implement a simple 2 part FormWizard. Form 1 will by dynamically generated something like this: class BuyAppleForm(forms.Form): creditcard = forms.ChoiceField(widget = forms.RadioSelect) type = forms.ChoiceField(widget = forms.RadioSelect) def __init__(self,*args, **kwargs): user = kwargs['user'] del kwargs['user'] super(BuyAppleForm, self).__init__(*args, **kwargs) credit_cards = get_credit_cards(user) self.fields['creditcard'].choices = [(card.id,str(card)) for card in credit

Django FormWizard with dynamic forms

╄→гoц情女王★ 提交于 2019-12-03 01:39:05
I want to implement a simple 2 part FormWizard. Form 1 will by dynamically generated something like this: class BuyAppleForm(forms.Form): creditcard = forms.ChoiceField(widget = forms.RadioSelect) type = forms.ChoiceField(widget = forms.RadioSelect) def __init__(self,*args, **kwargs): user = kwargs['user'] del kwargs['user'] super(BuyAppleForm, self).__init__(*args, **kwargs) credit_cards = get_credit_cards(user) self.fields['creditcard'].choices = [(card.id,str(card)) for card in credit_cards] apple_types= get_types_packages() self.fields['type'].choices = [(type.id,str(type)) for type in