Blog Archive for February 27, 2011

Converting a Postgres Database to UTF8

February 27, 2011

I have a database that is struggling to store some of the data my users are entering. It's a default postgres database, which means it's in LATIN1 not UTF8. This post covers converting a database from LATIN1 to UTF8.

Dump Database

Use pg_dump to get the data from the database …

Outputting CSV with Django

February 27, 2011

I wanted to output some data from my Django site, offering it as a CSV download. I did this using the Django template system.

Template

Here's the template used, which is a simple for loop.

{% for result in ContestResults %}
"{{ result.contest_event.event_date }}","{{ result.contest_event.name }}"," …