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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Markus H
June 02, 2015
Technology
1
9.9k
“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
260
Knock! Knock! Who's There?
markush
0
70
An Introduction To Kubernetes ☸
markush
0
110
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
66
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
toCプロダクトにおけるAI機能開発のしくじりと学び / ai-product-failures-and-learnings
rince
6
5k
2026年はチャンキングを極める!
shibuiwilliam
8
1.8k
~Everything as Codeを諦めない~ 後からCDK
mu7889yoon
2
140
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
780
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
120
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
290
Kubecon NA 2025: DRA 関連の Recap と社内 GPU 基盤での課題
kevin_namba
0
100
Introduction to Bill One Development Engineer
sansan33
PRO
0
350
セキュリティ はじめの一歩
nikinusu
0
1.3k
ドキュメントからはじめる未来のソフトウェア
pkshadeck
5
2.2k
re:Inventで出たインフラエンジニアが嬉しかったアップデート
nagisa53
4
230
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
66k
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
200
How to make the Groovebox
asonas
2
1.9k
sira's awesome portfolio website redesign presentation
elsirapls
0
140
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
Color Theory Basics | Prateek | Gurzu
gurzu
0
190
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
720
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
What's in a price? How to price your products and services
michaelherold
247
13k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
BBQ
matthewcrist
89
10k
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