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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
160
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
160
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces
pfn
PRO
0
140
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
130
Browser Spec: Testing Hotwire with Ruby
takahashim
1
120
TinyGoでオブザーバビリティ?OpenTelemetryはTinyGoで使えるのか / Is OpenTelemetry available in TinyGo environment?
ymotongpoo
2
140
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
230
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
350
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
110
Local CI × GitHub Actions
gogutan
2
210
go-sqletch
moznion
0
140
Classmethod Company Deck
satoshi7
1
700
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
360
Visualization
eitanlees
153
17k
Building AI with AI
inesmontani
PRO
1
1.3k
WENDY [Excerpt]
tessaabrams
14
40k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Everyday Curiosity
cassininazir
0
350
Git: the NoSQL Database
bkeepers
PRO
433
67k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Claude Code のすすめ
schroneko
67
230k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
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