Recently in Django Category
December 21, 2011
Python doesn't have special syntax for block comments, but if your IDE supports it, there may be a shortcut command to achieve roughly the same.
I'm using PyDev for Eclipse on a Mac, and the shortcut happens to be command+/ (command, forward slash.) Just select the block of code that you want to comment out, and use the shortcut key. A "#" will be inserted in front of each line that you highlighted.
With exactly the same lines selected, you can hit the shortcut key again to toggle the comments off. If you happen to select an extra line that was not commented out before, using the comment shortcut will add an additional "#" in front of each line.
The keyboard shortcut is easier to remember when you're using a language that uses slashes in the commenting syntax.
On a PC it's control+/
In a language that has special syntax for multi-line comments, you can use command+shift+/ (on a Mac) or control+shift+/ (on a PC.)
December 6, 2011
I was running through part 2 of the Django tutorial when I had to copy some files the Django source code directory. I'm on a Mac (Snow Leopard) and it happens to be at: