Modern browsers can display exciting visual effects such as drop shadows (without the use of background images). CSS3 makes it possible to turn submit inputs and even links into rich, Aqua-like buttons in these browsers (alternative style rules can be provided for older browsers).
>>> print [f.name for f in m._meta.fields]
>>> ['id', 'first_name', 'last_name', 'instrument']
This approach also works on models directly:
>>> print [f.name for f in Musician._meta.fields]
>>> ['id', 'first_name', 'last_name', 'instrument']
Advantages of using _meta.fields
items in returned list are correctly ordered
applicable to both models and instances
only fields are returned
The fact that only fields are returned is extremely useful. Django appears to add its own attributes to instances in certain circumstances; using _meta.fields prevents these from interfering with one's own code.
I've recently become interested in optimizing sites for the iPhone and iPod touch. While nothing beats testing on the device itself, I often find it quicker to test changes on my Mac. Changing the user agent string is a piece of cake in Safari (Develop > User Agent > Mobile Safari) but what about adjusting the browser window's dimensions to match those of the iPhone?
I've created two bookmarklets to allow the current page to be loaded in an iPhone-sized window with a single click: