django-formwizard

django manytomany field using through and formwizard

馋奶兔 提交于 2021-02-19 06:43:36
问题 I am trying to create a pretty complicated form and break it up using formwizard. The first thing I am trying to do is get the ManyToManyField using through to display, Then I need to figure out how to make it all save. #models.py ---------------------- class Meat(models.Model): name = models.charField(max_length=200) company = models.CharField(max_length = 200) class Starch(models.Model): name = models.CharField(max_length=200) company = models.CharField(max_length=200) class Recipe(models

Setting up Django Form Wizard

穿精又带淫゛_ 提交于 2020-04-30 14:26:53
问题 I'm attempting to set up a Django Form Wizard, but I'm having trouble getting it to work. I've followed the example, from the Django website, but can't get anything to work. When I go to the URL that should have my multistep form, only the template html thats extended shows up. What am I doing wrong here? FORMS.PY class ScheduleDate(forms.Form): date = forms.CharField() class ScheduleTime(forms.Form): time = forms.CharField() VIEWS.PY FORMS =[('date', ScheduleDate), ('time', ScheduleTime)]

Django: Saving Foreign Key from Form

懵懂的女人 提交于 2020-01-14 04:23:10
问题 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 =

Django-formwizard and ModelFormSet save

巧了我就是萌 提交于 2020-01-01 19:28:29
问题 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 =

Combining a Form and a FormSet in Django

∥☆過路亽.° 提交于 2019-12-25 06:16:41
问题 I have a FormWizard that displays three parts of a registration application. The last part involves creating a group and adding members to it. I would like to present two forms at once on the same view. Group Builder class GroupBuilder(forms.Form): name = forms.CharField(max_length=30, widget=forms.TextInput(attrs={ 'placeholder': 'eg. The Underdogs'})) Member Builder class MemberBuilder(forms.Form): first_name = forms.CharField(max_length=128) last_name = forms.CharField(max_length=128) role

Django formwizard with formsets and forms on same page

蹲街弑〆低调 提交于 2019-12-24 05:19:10
问题 I'm working with Django 1.4 FormWizard (specifically, NamedUrlFormWizard) first, the basics. i have a 3 step form wizard i'm building. The final outcome is along the lines of defining a template, and then choosing some people to use it, and then send them an email. Step 1 - enter in basic template data (name, description, etc) Step 2 - define a list of N fields, each with their own set of attributes but all identical in structure Step 3 - choose one or more users to email, AND customize the

form wizard initial data for edit not loading properly in Django?

☆樱花仙子☆ 提交于 2019-12-20 07:20:03
问题 I have a three page form-list coming out of a single model. I could save the model first time, but when I want to edit the model, only the first form shows the initial value, subsequent forms does not show the initial data. but when I print the initial_dict from views, I can see all the initial views correctly. I followed this blog on form wizard. Here is my model.py: class Item(models.Model): user=models.ForeignKey(User) price=models.DecimalField(max_digits=8,decimal_places=2) image=models

Django Drama: (Drag-n-Drop File Uploader in Multi-part Form) + (Bind File to Form / Model & Save to Postgres)

五迷三道 提交于 2019-12-14 04:21:47
问题 There are a few tiny related questions buried in here, but they really point to one big, hairy best practice question. This is kind of a tough feature to implement because it's supposed to do a couple tricky things at once... drag-and-drop multi-file uploader (via Javascript) multi-page form (page one: upload and associate files with an existing document model; page two: update and save file/document objects and meta-data to database) ...and I haven't found a pre-existing code sample or

Formwizards for editing in Django

旧街凉风 提交于 2019-12-13 12:50:38
问题 I am in the process of making a webapp, and this webapp needs to have a form wizard. The wizard consists of 3 ModelForms, and it works flawlessly. But I need the second form to be a "edit form". That is, i need it to be a form that is passed an instance. How can you do this with a form wizard? How do you pass in an instance of a model? I see that the FormWizard class has a get_form method, but isnt there a documented way to use the formwizard for editing/reviewing of data? 回答1: In Django 1.4

Custom Templates Django Formwizard

有些话、适合烂在心里 提交于 2019-12-11 22:20:12
问题 This may be obvious to some, but I cannot figure out how to over-ride get_template_name to provide a different template to the different steps of my form wizard . Here is what I have so far: class StepOneForm(forms.Form): color = forms.ChoiceField(choices=COLOR_CHOICES) ... class StepTwoForm(forms.Form): main_image = forms.ImageField() ... class StepThreeForm(forms.Form): condition = forms.ChoiceField(choices=CONDITION) ... class CreateWizard(SessionWizardView): file_storage =