DjangoCon US 2016 - Solving Problems With Django Forms by Kirt Gittens

preview_player
Показать описание
DjangoCon US 2016 - Solving Problems With Django Forms by Kirt Gittens

We'll look at a few core problems that we were able to solve with Django forms.

Dynamic Field Creation: What if you don't know what fields should be present on a Django form until runtime?. Solutions:

Pitfalls:

A fields validated attributes can't be manipulated dynamically because of Validators within the forms API. Dynamic form layouts become difficult to manage, crispyforms does not scale as a solution!

Validate a form via an API: How can external validations behave the same as internal errors? Solutions:

Adding fields at runtime: How can the user add fields to a form after it has been rendered?

Solutions:

Javascript can be used for the UI, and if the fields are properly named, the same validations will work as long as the fields are part of the form.

Pitfalls: Creating a solution that creates a dynamic field that is validated, but doesn't render can cause issues with your layout solution (crispyforms fails again here)

LINKS:
Follow DjangCon US 👇

Follow DEFNA 👇
Рекомендации по теме