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
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
130
CLIライブラリ開発を支える技術
htnabe
0
150
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
780
白金鉱業Meetup Vol.25 アウトカムが二値のデータに対するCausal Impact
brainpadpr
0
300
その Lambda、8分で 管理者権限まで奪われます
k1nakayama
7
3.7k
高負荷プロダクション環境におけるAWS Lambdaのリアル 〜スケールとコストを左右する実行ライフサイクルの技術仕様〜
maimyyym
2
530
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
180
Making AI Agents Safe and Fast- Jev, Obsidian, and the Meta-Harness
x5gtrn
PRO
0
140
Genieを崇めよ
kameitomohiro
0
170
「大丈夫そう?」をObservabilityで確かめる
mrmtsu
0
130
ほんとうの信頼性はヒーローが死んでからはじまる / True reliability begins after the hero dies
vtryo
0
120
Kiro Meetup #8 Kiro アップデート (2026/3/21〜2026/9/24)
katzueno
1
200
Featured
See All Featured
Practical Orchestrator
shlominoach
192
12k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Code Review Best Practice
trishagee
74
20k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
600
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
260
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
370
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