Ian Lewis Ian Lewis is a web developer living in Tokyo Japan. His current interests are in Django, python, alternative databases and rapid web application development.
About Me...

Field/column Queries in Django

One of the neat things making it's way into Django 1.1 is F object queries. The F object is kind of like the Q object as it can be used it queries but it represents a database field on the right hand side of an equality/inequality. For the example I'll use the example models from the "Making Queries" section of the Django Documentation. class Blog(models.Model): name = models.CharField[...]

Python date range iterator

I couldn't find something that gave me quite what I wanted so I created a simple Python generator to give me the dates between two datetimes. def datetimeIterator(from_date, to_date): from datetime import timedelta if from_date > to_date: return else: while from_date <= to_date: yield from_date from_date[...]

Introduction to Algorithms

Today my copy of Introduction to Algorithms came in the mail (a gift from the family). I've decided, mostly inspired by Peteris Krumins to revisit classic algorithms as it's been a while since I've taken a look at them. I have decided to also take a look at the MIT Intro to Algorithms course in order to revisit algorithms and concepts. I won't provide any lecture notes or anything since Pete[...]

Django Sitemap Framework

Using the Django sitemap framework is so easy it's almost no work at all. Just make a sitemap object and add it to the sitemap in urls.py. The sitemap framework calls items() in your Sitemap to get the list of objects to put in the sitemap and then calls get_absolute_url() on each object. #### models.py from django.db import models ... class Entry(models.Model): ... @permalink [...]

Django admin inline forms

For my new project dlife (Update: Now django-lifestream), I went about implementing a simple comments interface that would allow users to make comments on imported feed items. I wanted to support this in the admin in the typical manner such that when you click on an item in the admin, you can see all the comments and edit them from the item's page. I found that you can use inline forms in th[...]

Feedparser and Django

Over the weekend at Python Onsen I worked on a lifestream web application using Django and feedparser. I was really impressed with how simple feedparser is to use and how easy it is to get unified results from atom or rss feeds. You simply import feedparser and call feedparser.parse to parse a feed from a url. feeds.py ... def update_feeds(): feeds = Feed.objects.filter(feed_deleted=Fal[...]

Python Onsen Oct. 2008

Last weekend I went to my second Python Onsen[jp] organized by Nakai- san(id:voluntas). I talked about Python Onsen in my first blog post here. Python Onsen is a 3 day event (Fri, Sat, Sun) but as before I only participated on Saturday and Sunday. This time I opted to work on creating a lifestream web app using feedparser and Django. feedparser is a snappy little parser for reading RSS and At[...]

jsonschema 0.2 alpha

I just released a new version of jsonschema 0.2 alpha over at http://code.google.com/p/jsonschema The source can be downloaded here: jsonschema-0.2a.tar.gz The documentation can be found here: jsonschema (version 0.2a) documentation The new release includes the following notable changes. * The additionalProperties attribute is now validated. * Using schemas in the type attribute now w[...]

jsonschema mentioned on json.com

Kris Zyp (the author of the JSONSchema proposal) mentioned jsonschema on his blog at json.com. Thanks Kris!!

JSON Schema Validator 0.1a for Python

I just released the first version for a project that I've been working on since the Python Onsen. It's a validator for JSON Schema written in Python. It's based on the JSON Schema Proposal Second Draft. The source can be downloaded here: jsonschema-0.1a.tar.gz The source is on Bitbucket JSON Schema's purpose is to allow validation of JSON documents much like XML Schema, DTD. You can use it[...]