question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle Collection Type fields

See original GitHub issue

Feature description: Correctly handle fields such as List[str]

Curently when a field is of a collection type such as dict, list, Mapping, Sequence etc. the behaviour is broken. For the model

class ExampleModel(BaseModel):
        text: str
        many_texts: Sequence[str]

the output is broken image and pressing the submit button results in the following error Whoops! There were some problems with your input: many_texts: field required

Problem and motivation:

I have forms where some of the inputs are an arbitrary number of strings. Up until now I have solved this with a text_area widget, and prompt the user to separate their inputs with commas. Then with a custom validator the strings can be put back into a list. While this kinda works, it is a very hacky solution, it prevents me from using this package without breaking up my model

Is this something you’re interested in working on?

Currently I don’t have the capacity but it is something that am willing to look into in the near future (in a couple of months)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
disbr007commented, Feb 8, 2022

@LukasMasuch Just wanted to bump this as I am running into the issue as well. Any thoughts on a solution or workaround? I’d be happy to try to help contribute if you have ideas.

Great package btw!

0reactions
github-actions[bot]commented, Nov 9, 2022

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

Read more comments on GitHub >

github_iconTop Results From Across the Web

CollectionType Field (Symfony Docs)
This field type is used to render a "collection" of some field or form. In the easiest sense, it could be an array...
Read more >
collection Field Type - Symfony Documentation - Read the Docs
This field type is used to render a “collection” of some field or form. In the easiest sense, it could be an array...
Read more >
Symfony CollectionType with different fields - Stack Overflow
I don't know how to write the RequirementType , as they are not exactly the same (size, shape, color, ...). This is what...
Read more >
Content Manager: About Your Collection Fields | Help Center
The Field Type defines what kind of content the field contains. When you add a new field in the Content Manager, you choose...
Read more >
Use Collection fields to build custom Collections
Select from Collection field types to help build your custom Collection. Choose from plain text. Open the CMS Collection panel and create a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found