ChrisCooper/QcumberD — pull request #20 by uniphil (2013-01-05 16:09:14+00:00)
Title: SQLite Support

The `subject_detail` and `course_detail` views currently use the `.distinct()` method to create a list of grouping fields. That method is postgres-only, and broke my local installation (sqlite) as soon as I scraped some courses.

I refactored those views, using a `dict` (`defaultdict`, actually) to group things.

It could be even cleaner to use a `DefaultOrderedDict` like this one: http://stackoverflow.com/a/6190500/1299695 , since at least in the case of `course_detail`, all of the ordering can be taken care of in the sql query. I wasn't sure where to put that class though. Felt cluttered in `views.py`. I wasn't quite gutsy enough to create a `tools.py` or something. What do you think?

`DefaultOrderedDict`s could be passed directly to the templates (though the templates would have to be modified to accept the new format).