Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
“Forms are static” – “No, they aren't”
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Markus H
June 02, 2015
Technology
1
10k
“Forms are static” – “No, they aren't”
My talk from DjangoCon Europe 2015 in Cardiff, Wales
Markus H
June 02, 2015
Tweet
Share
More Decks by Markus H
See All by Markus H
🐍 ❤️ 🦀 — Python loves Rust
markush
0
270
Knock! Knock! Who's There?
markush
0
76
An Introduction To Kubernetes ☸
markush
0
120
Writing Safe Database Migrations (DjangoCon Europe 2021)
markush
0
14k
A Pony On The Move: How Migrations Work In Django 🐎
markush
0
13k
All Hands on Deck — Handling Security Issues
markush
0
14k
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon UK 2019)
markush
0
69
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
220
Logging Rethought 2: The Actions of Frank Taylor Jr. (DjangoCon Europe 2019)
markush
0
13k
Other Decks in Technology
See All in Technology
Datadog の RBAC のすべて
nulabinc
PRO
3
340
聲の形にみるアクセシビリティ
tomokusaba
0
150
Evolution of Claude Code & How to use features
oikon48
1
530
ビズリーチにおける検索・推薦の取り組み / DEIM2026
visional_engineering_and_design
1
120
メタデータ同期に潜んでいた問題 〜 Cache Stampede 時の Cycle Wait を⾒つけた話
lycorptech_jp
PRO
0
150
[AEON TECH HUB #24] お客様の長期的興味の理解に向けて
alpicola
0
120
チームメンバー迷わないIaC設計
hayama17
5
4k
SaaSからAIへの過渡期の中で現在、組織内で起こっている変化 / SaaS to AI Paradigm Shift
aeonpeople
0
100
クラウド時代における一時権限取得
krrrr38
1
170
kintone開発のプラットフォームエンジニアの紹介
cybozuinsideout
PRO
0
840
マネージャー版 "提案のレベル" を上げる
konifar
21
14k
トップマネジメントとコンピテンシーから考えるエンジニアリングマネジメント
zigorou
4
750
Featured
See All Featured
Become a Pro
speakerdeck
PRO
31
5.8k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
140
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
230
Building the Perfect Custom Keyboard
takai
2
710
How GitHub (no longer) Works
holman
316
140k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
76
Raft: Consensus for Rubyists
vanstee
141
7.3k
Docker and Python
trallard
47
3.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Deep Space Network (abreviated)
tonyrice
0
86
Why Our Code Smells
bkeepers
PRO
340
58k
Transcript
“Forms are static” – “No, they aren't”
Hi, I’m Markus Holtermann • Django Core Developer • CS
MSc Student @m_holtermann • github.com/MarkusH • markusholtermann.eu
Forms are static
What does “static” even mean?
What about request dependent forms?
They are static too!
What are non-static forms then?
Why do you need them?
How does that work?
def modelform_factory(model, …): attrs = { ‘fields’: fields_for_model(model), ‘model’: model,
} Meta = type(str('Meta'), (object,), attrs) class_attrs = {‘Meta’: Meta} class_name = model.__name__ + str('Form') return type( class_name, ModelForm, class_attrs )
Wait! Aren’t they still static?
type(name, bases, attrs) rocks!
django-dynamic-forms http://django-dynamic-forms.rtfd.org
Actions FormModel Name URLs Name FormFieldModel Options Label … …
belongs to
@formmodel_action('Send to admins') def send_admins(form_model, form, request): # label →
value mapped_data = form.get_mapped_data() # construct message message = render_to_string( 'dynamic_forms/email.txt', { 'form': form_model, 'data': mapped_data}) # send data via mail mail_admins( “New form submission”, message )
@dynamic_form_field class IntegerField(BaseDynamicFormField): cls = 'django.forms.EmailField' display_label = 'Email' class
Meta: # attribute = [type, default, class] max_value = [int, None, forms.IntegerField] min_value = [int, None, forms.IntegerField]
None
None
None
django-dynamic-forms http://django-dynamic-forms.rtfd.org
Thank You! @m_holtermann • github.com/MarkusH • markusholtermann.eu