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
『SAR衛星データ解析入門』のご紹介とその応用
syuchimu
0
120
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
3
1.1k
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
430
re:Invent初参加で変わったこと、2回目にやってみたいこと(JAWS-UG彩の国埼玉 #12)
mhrtech
2
230
Optunaの最新リリースv5.0について
pfn
PRO
0
120
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
110
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
130
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
770
Classmethod Company Deck
satoshi7
1
690
Running Kotlin + Quarkus with Lambda
nealle
1
3.7k
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
480
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
120
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
BBQ
matthewcrist
90
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.4k
Prompt Engineering for Job Search
mfonobong
0
520
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