Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Some random Django tips
Search
adrianholovaty
September 05, 2013
Technology
480
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Some random Django tips
My lightning talk from DjangoCon Chicago 2013.
adrianholovaty
September 05, 2013
More Decks by adrianholovaty
See All by adrianholovaty
The year ahead (DjangoCon 2012)
adrianholovaty
1
670
Other Decks in Technology
See All in Technology
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.7k
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
9
1.1k
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
140
AI時代、データエンジニアが一番おもろい
genshun9
0
690
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
510
AI時代の「技術的負債」の変質ー概念の終焉と再解釈、エージェントと共に向かう先
nwiizo
1
3.2k
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
11
5.1k
Why Agent Cost Needs Observability
nttcom
0
140
手を動かして実感する、Kiro が変える開発体験
inariku
0
210
The Knowledge Spine: A Machine-Executable Ontology for Governed Marketing Activation
vananth22
0
120
AI de Idea
kawaguti
PRO
2
130
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
440
GitHub's CSS Performance
jonrohan
1033
470k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Music & Morning Musume
bryan
48
7.4k
Odyssey Design
rkendrick25
PRO
2
810
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
What's in a price? How to price your products and services
michaelherold
247
13k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
250
Transcript
Some random Django tips Adrian Holovaty, DjangoCon Chicago 2013
None
None
<body> {% if USER %} Logged in as {{ USER.username
}} {% else %} <a href=”/login/”>Log in</a> {% endif %} {% for item in items %} <p>{{ item.name }}</p> {% endfor %} </body>
<body> {% if USER %} Logged in as {{ USER.username
}} {% else %} <a href=”/login/”>Log in</a> {% endif %} {% for item in items %} <p>{{ item.name }}</p> {% endfor %} </body>
Template Rendered to HTML Sent to user
Template Template Rendered to HTML Rendered into another template Rendered
to HTML (middleware) Sent to user Sent to user
<body> {% raw %} {% if USER %} Logged in
as {{ USER.username }} {% else %} <a href=”/login/”>Log in</a> {% endif %} {% endraw %} {% for item in items %} <p>{{ item.name }}</p> {% endfor %} </body>
gist.github.com/adrianholovaty
qs = Song.objects.filter(artist=‘Django’) if request.user: qs = qs.filter(user_id=request.user.id)
qs = Song.objects.filter(artist=‘Django’) if request.user: qs = qs.filter(user_id=request.user.id) kwargs =
{‘artist’: ‘Django’} if request.user: kwargs[‘user_id’] = request.user.id qs = Song.objects.filter(**kwargs)
urlpatterns = patterns(‘’, # ... (r'^(yt|pro)/([-_\w]{1,35})/api/$', views.song_api), (r'^(yt|pro)/([-_\w]{1,35})/edit/$', views.song_edit_form), (r'^(yt|pro)/([-_\w]{1,35})/clear-bars/$',
views.clear_bars), (r'^(yt|pro)/([-_\w]{1,35})/delete/$', views.song_delete), )
urlpatterns = patterns(‘’, # ... (r'^(?P<src>yt|pro)/(?P<sid>[-_\w]{1,35})/', include(patterns('', (r'^api/$', views.song_api), (r'^edit/$',
views.song_edit_form), (r'^clear-bars/$', views.clear_bars), (r'^delete/$', views.song_delete), ))), ) urlpatterns = patterns(‘’, # ... (r'^(yt|pro)/([-_\w]{1,35})/api/$', views.song_api), (r'^(yt|pro)/([-_\w]{1,35})/edit/$', views.song_edit_form), (r'^(yt|pro)/([-_\w]{1,35})/clear-bars/$', views.clear_bars), (r'^(yt|pro)/([-_\w]{1,35})/delete/$', views.song_delete), )
class Track(models.Model): # ... version = models.IntegerField() def cache_key(self): return
‘track:{0}.{1}’.format(self.id, self.version)
None
control+click