Generating vCards using VObject
Use this code to generate downloadable [vCard][] objects. See the [VObject docs][1] for more details on the API. [1]: http://vobject.skyhouseconsulting.com/ [vcard]: http://en.wikipedia.org/wiki/VCard
- vcard
- view
Use this code to generate downloadable [vCard][] objects. See the [VObject docs][1] for more details on the API. [1]: http://vobject.skyhouseconsulting.com/ [vcard]: http://en.wikipedia.org/wiki/VCard
Described more fully on [my blog](http://e-scribe.com/news/230), but the gist is: this model becomes a sort of mini-app in your admin, allowing you to record and track issues related to your other applications. Sorting still needs some work. UPDATED 2007-03-14: Fixed repeat in Admin.list_display (thanks, burly!); added Admin.list_filter; changed app list (why did I call that `PROJECTS`, anyway?) to omit "django.*" apps
A mildly crufty script to slurp mail from an mbox into a Django model. I use a variant of this script to pull the contents of my scammy-spam mbox into the database displayed at <http://purportal.com/spam/>
I work with multiple projects, many of which have multiple custom management commands defined. It can be hard to remember them, and slow to pick them out of the "manage.py help" list. This quickie command lists all of a project's custom commands (along with their help text). Writing it was easy after looking at the source of django.core.management. Open questions include: how do you decide which app to put this command in? Should this command list itself?
I use these helper methods in my unit tests. They turn many simple getting-and-posting tests into one-liners. Definitely a work in progress, and I can't be the only person who has done this sort of thing -- comments are more than welcome.
This tag makes it easy to have a random rotation of images on a page. Don't forget to set your MEDIA_URL.
Taken from the [longer description on my blog][1]: > One of the great things about Django is its simple and flexible URL handling. If your Django work, like mine, includes converting existing sites, you’ll probably be doing some URL cleanup along the way... Just plug your old/new URL pairs into `redirects`. [1]: http://e-scribe.com/news/290
This is a general-purpose utility function, but since it uses lazy sequences via itertools, so it should be suitable for use with Querysets.
This script can be run periodically (e.g. as a nightly cronjob) to keep a SQLite database with high churn from growing unnecessarily large.
On a busy site it can be nice to have a summary of admin activity. Running this command (I call it "adminlog") generates output like this: 2009-07-10 18:06:19: pbx changed flat page: "/yay/ -- Let's All Say Yay" By default it shows the last five actions; pass it a numerical arg to show more or fewer. Run this as a cron job and you can follow a site's admin-side activity without even logging in!