Use Dot Notation to Build Django Contexts

Michael Shepanski
February 5, 2012

One thing about Django views that I personally find a bit annoying is using dictionary notation when building the context to pass to my templates. I don't find this a big deal for smaller views, but sometimes I have quite a bit of variables to pass back to my template. Organization, readability and maintainability often do not come in the syntactic form of a large dictionary of random objects.

Multiple Arguments in a Django Filter

Michael Shepanski
January 29, 2012

Custom Django filters are an awesome thing. One downside however is they don't easily allow multiple arguments passed through. I am finding in my time with Django I am wanting multiple arguments more and more. For example, lets look at the simple replace filter below.

Django Decorator to Print SQL Queries

Michael Shepanski
November 27, 2011

Django's ORM is great for fast development, but it is sometimes all too easy to write inefficient queries in the language. There are a few options to help find rogue queries sucking all that process time. My favorite is of course Django Debug Toolbar. However, sometimes this is not a viable option, such as when writing AJAX processors, or for some reason DDTB is not available to you.

This simple decorator may help you alleviate some pain. It also becomes a useful tool to copy and paste the queries into an external query browser. My favorite for Linux is CrunchyFrog.

Backup Django Database to Dropbox

Michael Shepanski
January 12, 2011

There is no question that backups are important. Backups should always be offsite, and no matter how many backups you are creating, you're always one too short. For this blog, as simple as it is, I have many backup mechanisms in place. The last of which is covered in this blog post.

  • Bitbucket backups my code base keeping copies in several different physical locations.
  • For $5/mo Slicehost will keep 3 backup of my linux setup on their servers.
  • Nightly snapshots of Postgres database stored on Dropbox.

Thoughts on Django After My First Project

Michael Shepanski
October 14, 2009

So I finally bit the bullet and made a blog. This started as more of an effort for me to learn Django. However, I quickly realized I wanted a place to post about all the things I am learning along the way. So this place will tend to be about coding Python, Django, jQuery, and the occasional personal post.

What better for a first post than talk about my experience writing my first Django app. I am now right dab in the middle of those early stages of learning a new language when you curse and swear that everything you previously learned is better. As a disclaimer for what you are about to read, I would like to point out that not everything below may be accurate. However, this is in my best words what I experienced while trying to learn.