8000 Initial on Formset · Issue #452 · viewflow/viewflow · GitHub
[go: up one dir, main page]

Skip to content

Initial on Formset #452

@joff13

Description

@joff13

Hi

with Django Form is it possible to do something like

    ParagraphsFormSet = forms.formset_factory(ParagraphsForm, extra=2, can_delete=True)
    formset = ParagraphsFormSet(initial=[
        {'paragraph_title': 'Django is now open source',
        'paragraph_content': "datetime.date.today()",}
    ])

or

  initial_list = [
      {'paragraph_title': 'Title 1', 'paragraph_content':"Content 1"},
      {'paragraph_title': 'Title 2', 'paragraph_content':"Content 2"},
      {'paragraph_title': 'Title 3', 'paragraph_content':"Content 3"},
      {'paragraph_title': 'Title 4', 'paragraph_content':"Content 4"},
      {'paragraph_title': 'Title 5', 'paragraph_content':"Content 5"},
  ]
  
  ParagraphsFormSet = forms.formset_factory(ParagraphsForm, extra=2, can_delete=True)
  formset = ParagraphsFormSet(initial=initial_list)

and use formset prefilled

I'm trying to achieve the same with Viewflow formset

  ParagraphsFormSet = forms.formset_factory(ParagraphsForm, extra=2, can_delete=True)
  paragraphs = FormSetField(formset_class=ParagraphsFormSet, )
  layout = Layout(
      FormSet("paragraphs",card_desktop=12),
  )

but nothing seams to work
FormSet cannot have initial
FormSetField no error with initial but no output

any suggestion?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0