SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
11/18/2008, 7PM
      django-nyc
      Will Larson

      An intermediate
      over view of useful
      features.




charting django
   (A map to avoiding that
  “Where is the bathroom?”
      “Under the sign.”
           “Oh.”
          feeling.)
qualifications
It’s all true. Damnit.




           • Spent last year as English teacher.
           • Last presentation was to 13 year olds.
           • People skills. Damn it.
This presentation is
geared towards


                      django roadmap
advanced beginners, who
want a guide to become
intermediate
Djangonauts.

I hate that term.



          • beginner - templates, views and urls
          • intermediate - why you’re listening to me
          • advanced - reusable applications

          <img src=“funnyPicture.png”>Cats? Kids?</img>
Everyone needs three projects in their


                      django experience
trip towards Django mastery.

Don’t be afraid to start over from
scratch. When you make decisions
with insufficient knowledge is like
trying to get into a building when you
don’t know how to open doors.
              Project a hole in               Concept         Status
You’ll probably have to blow
the wall, and even after you learn
about the door the hole is still going to
       GalleryProject
be there.
                                            gallery builder

             LifeFlow                        blog engine

     django-userskins user-specific skins
Almost all of this functionality
                     can be ignored, but by using it


• local_settings.py
                     your applications can be smaller,
                     more flexible, and much easier to
                     write.        easy to feign mastery
                     Moving from beginner to adept is

• fixtures            about increasing efficiency and
                     quality, not necessarily about
                     doing new things, but doing old
                     things better.


• template tags & filters
• management commands
• custom context
                                harder to feign mastery
• middleware
This is a common
convention, rather than
a feature.

It’s even harder to learn
convention than to learn
                          local_settings.py
features, because they’re
often undocumented.



           • some project settings are location specific
           • some are not
           • Don’t Repeat Yourself
           • => local_settings.py
settings.py




local_settings.py
local_settings.py in VC
• versioned:
 • settings.py
 • local_settings.py.template
 • kitchen sink
• not versioned:
 • local_settings.py
local_settings.py variant
                                       This is how I roll.

                                       Bringing settings
                                       inheritance to the weary
                                       developer/sys admin

• 2 + max(n,1) settings files           hybrid.




• settings.py
• local_settings.py (not in version control!)
• ???_settings.py (deploy, devel, staging, etc)
                                        local_settings.py
Can be used for initial and


              fixtures
                                  testing data, as well.

                                  I use fixtures to maintain a
                                  local copy of my blog, to
                                  extract data to run

• export and import data          statistics, and--sadly--I do
                                  use it for simple migrations.


• extremely poor man’s schema migration
                                 shell session
template tags & filters
        • Don’t Repeat Yourself for templates
You’ve probably used the
default templates and
filters before. They’re
good, but sometimes you
run into missing
functionality.

Time to roll your own.




        • use when justified
template filters
         myapp/templatetags/magic.py




                some_template.html
template tags, 1
• more powerful & complex than filters
                           Kevin t wittered about the “pyif”
                           templatetag. That’s a great example of
                              some_template.html
                           complex and powerful.

                           That’s because it’s mostly a wrapper
                           around the Python eval() function, i.e. it
                           is basically a templatetag that provides
                           direct access to the Python interpreter.

                           Model-View-Controller be damned, lets
                           throw the interpreter into the templates.
template tags, 2
                   monetize.py
management commands
• periodic or one-time commands
• great with cron                 This is your primary
                                  interface bet ween the
                                  shell and Django, along
                                  with:

                                  python manage.py shell
clean_revisions.py




  shell session
custom context              These really extend the usability
                                   of generic views by letting you
                                   inject arbitrary data into all
                                   templates (well, all templates

• manage global information        served by views that use
                                   RequestContext, which includes
                                   generic views).

• play nicely with generic views   Try to keep them light weight to
                                   avoid slowing down everything.

                                         settings.py
context.py
middleware
• four levers to defy Django physics
    • process_request        This is a totally inadequate
                             introduction to middleware, which are
                             one of the more nuanced features of

    • process_view           Django.

                             You could have a 30 minute talk that


    • process_response
                             solely focused on middleware and still
                             have questions left over and rocks
                             left unturned.


    • process_exception      This is a sketch of a sketch of a map,
                             but that’s all the time we have.
middleware.py




middleware.py
Visit my blog if you’re
         interested in reading
         about... stuff. Yeah, or don’t
         visit it. That’s cool too.

         What isn’t cool is how
         smilely faces look in
         Marker Felt.




• Irrational Exuberance @ http://lethain.com/
• django-monetize @ http://github.com/
  lethain/django-monetize/tree/master/

Más contenido relacionado

Destacado

Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)
Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)
Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)theoaraujo
 
How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...
How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...
How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...OMcareers Community
 
iDoc24 presentation Amsterdam ISTD 2010 public
iDoc24 presentation Amsterdam ISTD 2010 publiciDoc24 presentation Amsterdam ISTD 2010 public
iDoc24 presentation Amsterdam ISTD 2010 publicAlexander Börve
 
Fretten spreekbeurt
Fretten spreekbeurtFretten spreekbeurt
Fretten spreekbeurtbrickston
 
AIESEC EE_MT internship in MarkIT_for Denmark, Sweden, Norway
AIESEC EE_MT internship in MarkIT_for Denmark, Sweden, NorwayAIESEC EE_MT internship in MarkIT_for Denmark, Sweden, Norway
AIESEC EE_MT internship in MarkIT_for Denmark, Sweden, Norwaysmileyaika
 
Qualche considerazione sulla mobilità dei ricercatori INFN
Qualche considerazione sulla mobilità dei ricercatori INFNQualche considerazione sulla mobilità dei ricercatori INFN
Qualche considerazione sulla mobilità dei ricercatori INFNPaolo Valente
 
Kendel Avaya-Fabric connect - Demo Lab Guide - basic-1
Kendel   Avaya-Fabric connect - Demo Lab Guide - basic-1Kendel   Avaya-Fabric connect - Demo Lab Guide - basic-1
Kendel Avaya-Fabric connect - Demo Lab Guide - basic-1ELI KENDEL אלי קנדל
 
From Kalyani To Chillibreeze!
From Kalyani To  Chillibreeze!From Kalyani To  Chillibreeze!
From Kalyani To Chillibreeze!suresh.kalyani
 
Port royal market update sample
Port royal market update samplePort royal market update sample
Port royal market update samplemelanieharo
 
Scale Cloud across Enterprise
Scale Cloud across EnterpriseScale Cloud across Enterprise
Scale Cloud across EnterpriseChris Haddad
 
Le Vie D’Acqua
Le Vie D’AcquaLe Vie D’Acqua
Le Vie D’Acquajanaem
 
Prueba
PruebaPrueba
Pruebakirsej
 
The Globe And Facebook
The Globe And FacebookThe Globe And Facebook
The Globe And FacebookMathew Ingram
 
Pickme - Finding the Initial Team
Pickme - Finding the Initial TeamPickme - Finding the Initial Team
Pickme - Finding the Initial TeamFathhi Mohamed
 
Seeker [ehv3] Eindhoven
Seeker [ehv3] EindhovenSeeker [ehv3] Eindhoven
Seeker [ehv3] EindhovenTom Veeger
 
Paolo Valente per RN dei ricercatori INFN
Paolo Valente per RN dei ricercatori INFNPaolo Valente per RN dei ricercatori INFN
Paolo Valente per RN dei ricercatori INFNPaolo Valente
 

Destacado (20)

Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)
Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)
Network Analysis Workshop - Review of Onnela & Reed-Tsochas (2010)
 
Check Point Command
Check Point CommandCheck Point Command
Check Point Command
 
How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...
How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...
How International Startups Leverage Networks In Their Own Backyard Nasscom Fr...
 
iDoc24 presentation Amsterdam ISTD 2010 public
iDoc24 presentation Amsterdam ISTD 2010 publiciDoc24 presentation Amsterdam ISTD 2010 public
iDoc24 presentation Amsterdam ISTD 2010 public
 
Fretten spreekbeurt
Fretten spreekbeurtFretten spreekbeurt
Fretten spreekbeurt
 
Evidence
EvidenceEvidence
Evidence
 
AIESEC EE_MT internship in MarkIT_for Denmark, Sweden, Norway
AIESEC EE_MT internship in MarkIT_for Denmark, Sweden, NorwayAIESEC EE_MT internship in MarkIT_for Denmark, Sweden, Norway
AIESEC EE_MT internship in MarkIT_for Denmark, Sweden, Norway
 
Qualche considerazione sulla mobilità dei ricercatori INFN
Qualche considerazione sulla mobilità dei ricercatori INFNQualche considerazione sulla mobilità dei ricercatori INFN
Qualche considerazione sulla mobilità dei ricercatori INFN
 
Kendel Avaya-Fabric connect - Demo Lab Guide - basic-1
Kendel   Avaya-Fabric connect - Demo Lab Guide - basic-1Kendel   Avaya-Fabric connect - Demo Lab Guide - basic-1
Kendel Avaya-Fabric connect - Demo Lab Guide - basic-1
 
From Kalyani To Chillibreeze!
From Kalyani To  Chillibreeze!From Kalyani To  Chillibreeze!
From Kalyani To Chillibreeze!
 
UX Proposal
UX ProposalUX Proposal
UX Proposal
 
Port royal market update sample
Port royal market update samplePort royal market update sample
Port royal market update sample
 
Scale Cloud across Enterprise
Scale Cloud across EnterpriseScale Cloud across Enterprise
Scale Cloud across Enterprise
 
Le Vie D’Acqua
Le Vie D’AcquaLe Vie D’Acqua
Le Vie D’Acqua
 
Prueba
PruebaPrueba
Prueba
 
The Globe And Facebook
The Globe And FacebookThe Globe And Facebook
The Globe And Facebook
 
Pickme - Finding the Initial Team
Pickme - Finding the Initial TeamPickme - Finding the Initial Team
Pickme - Finding the Initial Team
 
Seeker [ehv3] Eindhoven
Seeker [ehv3] EindhovenSeeker [ehv3] Eindhoven
Seeker [ehv3] Eindhoven
 
Monogram Persalinan Normal
Monogram Persalinan NormalMonogram Persalinan Normal
Monogram Persalinan Normal
 
Paolo Valente per RN dei ricercatori INFN
Paolo Valente per RN dei ricercatori INFNPaolo Valente per RN dei ricercatori INFN
Paolo Valente per RN dei ricercatori INFN
 

Último

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Último (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Charting Django

  • 1. 11/18/2008, 7PM django-nyc Will Larson An intermediate over view of useful features. charting django (A map to avoiding that “Where is the bathroom?” “Under the sign.” “Oh.” feeling.)
  • 2. qualifications It’s all true. Damnit. • Spent last year as English teacher. • Last presentation was to 13 year olds. • People skills. Damn it.
  • 3. This presentation is geared towards django roadmap advanced beginners, who want a guide to become intermediate Djangonauts. I hate that term. • beginner - templates, views and urls • intermediate - why you’re listening to me • advanced - reusable applications <img src=“funnyPicture.png”>Cats? Kids?</img>
  • 4. Everyone needs three projects in their django experience trip towards Django mastery. Don’t be afraid to start over from scratch. When you make decisions with insufficient knowledge is like trying to get into a building when you don’t know how to open doors. Project a hole in Concept Status You’ll probably have to blow the wall, and even after you learn about the door the hole is still going to GalleryProject be there. gallery builder LifeFlow blog engine django-userskins user-specific skins
  • 5. Almost all of this functionality can be ignored, but by using it • local_settings.py your applications can be smaller, more flexible, and much easier to write. easy to feign mastery Moving from beginner to adept is • fixtures about increasing efficiency and quality, not necessarily about doing new things, but doing old things better. • template tags & filters • management commands • custom context harder to feign mastery • middleware
  • 6. This is a common convention, rather than a feature. It’s even harder to learn convention than to learn local_settings.py features, because they’re often undocumented. • some project settings are location specific • some are not • Don’t Repeat Yourself • => local_settings.py
  • 8. local_settings.py in VC • versioned: • settings.py • local_settings.py.template • kitchen sink • not versioned: • local_settings.py
  • 9. local_settings.py variant This is how I roll. Bringing settings inheritance to the weary developer/sys admin • 2 + max(n,1) settings files hybrid. • settings.py • local_settings.py (not in version control!) • ???_settings.py (deploy, devel, staging, etc) local_settings.py
  • 10. Can be used for initial and fixtures testing data, as well. I use fixtures to maintain a local copy of my blog, to extract data to run • export and import data statistics, and--sadly--I do use it for simple migrations. • extremely poor man’s schema migration shell session
  • 11. template tags & filters • Don’t Repeat Yourself for templates You’ve probably used the default templates and filters before. They’re good, but sometimes you run into missing functionality. Time to roll your own. • use when justified
  • 12. template filters myapp/templatetags/magic.py some_template.html
  • 13. template tags, 1 • more powerful & complex than filters Kevin t wittered about the “pyif” templatetag. That’s a great example of some_template.html complex and powerful. That’s because it’s mostly a wrapper around the Python eval() function, i.e. it is basically a templatetag that provides direct access to the Python interpreter. Model-View-Controller be damned, lets throw the interpreter into the templates.
  • 14. template tags, 2 monetize.py
  • 15. management commands • periodic or one-time commands • great with cron This is your primary interface bet ween the shell and Django, along with: python manage.py shell
  • 17. custom context These really extend the usability of generic views by letting you inject arbitrary data into all templates (well, all templates • manage global information served by views that use RequestContext, which includes generic views). • play nicely with generic views Try to keep them light weight to avoid slowing down everything. settings.py
  • 19. middleware • four levers to defy Django physics • process_request This is a totally inadequate introduction to middleware, which are one of the more nuanced features of • process_view Django. You could have a 30 minute talk that • process_response solely focused on middleware and still have questions left over and rocks left unturned. • process_exception This is a sketch of a sketch of a map, but that’s all the time we have.
  • 21. Visit my blog if you’re interested in reading about... stuff. Yeah, or don’t visit it. That’s cool too. What isn’t cool is how smilely faces look in Marker Felt. • Irrational Exuberance @ http://lethain.com/ • django-monetize @ http://github.com/ lethain/django-monetize/tree/master/