2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 04:25:42 +00:00

Added step description and crispy form tag

This commit is contained in:
eeintech
2021-05-04 10:28:00 -04:00
parent b847604f15
commit 373898d43e
5 changed files with 60 additions and 31 deletions

View File

@ -23,18 +23,3 @@ class SettingEditForm(HelperForm):
fields = [
'value'
]
class UploadFile(forms.Form):
''' Step 1 '''
first_name = forms.CharField(max_length=100)
class MatchField(forms.Form):
''' Step 2 '''
last_name = forms.CharField(max_length=100)
class MatchPart(forms.Form):
''' Step 3 '''
age = forms.IntegerField()

View File

@ -105,10 +105,25 @@ class SettingEdit(AjaxUpdateView):
form.add_error('value', _('Supplied value must be a boolean'))
class FileUploadWizardView(SessionWizardView):
# file_storage = FileSystemStorage(location=os.path.join(settings.MEDIA_ROOT, 'file_uploads'))
form_list = [
forms.UploadFile,
forms.MatchField,
forms.MatchPart,
]
class MultiStepFormView(SessionWizardView):
""" Setup basic methods of multi-step form
form_list: list of forms
form_steps_description: description for each form
"""
form_list = []
form_steps_description = []
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# Get description
try:
description = self.form_steps_description[int(self.steps.current)]
except IndexError:
description = ''
# Add description to form steps
context.update({'description': description})
return context