$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Some random Django tips
Search
adrianholovaty
September 05, 2013
Technology
1
480
Some random Django tips
My lightning talk from DjangoCon Chicago 2013.
adrianholovaty
September 05, 2013
Tweet
Share
More Decks by adrianholovaty
See All by adrianholovaty
The year ahead (DjangoCon 2012)
adrianholovaty
1
640
Other Decks in Technology
See All in Technology
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
210
ActiveJobUpdates
igaiga
1
320
特別捜査官等研修会
nomizone
0
580
20251222_サンフランシスコサバイバル術
ponponmikankan
2
140
Strands Agents × インタリーブ思考 で変わるAIエージェント設計 / Strands Agents x Interleaved Thinking AI Agents
takanorig
5
2.1k
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
140
たまに起きる外部サービスの障害に備えたり備えなかったりする話
egmc
0
410
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
1
410
[Data & AI Summit '25 Fall] AIでデータ活用を進化させる!Google Cloudで作るデータ活用の未来
kirimaru
0
3.9k
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
220
100以上の新規コネクタ提供を可能にしたアーキテクチャ
ooyukioo
0
260
Entity Framework Core におけるIN句クエリ最適化について
htkym
0
130
Featured
See All Featured
Side Projects
sachag
455
43k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
2
2.8k
GraphQLとの向き合い方2022年版
quramy
50
14k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
How STYLIGHT went responsive
nonsquared
100
6k
Building an army of robots
kneath
306
46k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
200
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
400
Skip the Path - Find Your Career Trail
mkilby
0
27
New Earth Scene 8
popppiees
0
1.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
33
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