Django: Forcing a Multiple Choice Widget into a delimited CharField

This works, but is there a better way, like only modifying a Widget or a Field?

class TextCheckboxSelectMultiple(widgets.CheckboxSelectMultiple):
    """
    Set checked values based on a comma separated list instead of a python list
    """
    def render(self, name, value, **kwargs):
        if isinstance(value, basestring):
            value = value.split(",")
        return super(TextCheckboxSelectMultiple, self).render(name, value, **kwargs)

class TextMultiField(forms.MultipleChoiceField):
    """
    Work in conjunction with TextCheckboxSelectMultiple to store a
    comma separated list of multiple choice values in a CharField/TextField
    """
    widget = TextCheckboxSelectMultiple
    def clean(self, value):
        val = super(TextMultiField, self).clean(value)
        return ",".join(val)
— by Rob, created 15th Sep, 2009, last modified 15th Sep, 2009 | Tags: Tech

 We're in Berlin!

We've been in Berlin for a little over a week now. We've mostly recovered from the sunburn we got in Taormina (it's all too easy to get sunburnt when you have clouds and a pool), and I'm almost recovered from the stresses of Etna. It was a fantastic experience though.

Right now, I'm trying to juggle work (finishing off projects from before the holiday) and apartment hunting. Oh yeah, Sophia got accepted into FU Berlin, the University she wanted to change to, so she's now in the progress of switching and she has to give notice on her apartment in Passau, and we have to arrange transport for her goods. I think it will be an expensive affair, this moving business. But I'm looking forward to having a Zuhause again. In every place that I've stayed since 2004, I've treated it as temporary lodgings, so I didn't really settle down.

I'm also deciding whether I want to find a proper job here and go mainstream, or continue contracting.. Or maybe both.. I think it will come down to a combination of money and life satisfaction in the end. I can afford to wait for the right opportunity, though.

— by Robert Thomson, created 11th Sep, 2009, last modified 11th Sep, 2009 | Tags: World

 Second Travel Report

2. September

Catania's a nice city - a real city - not too much visible tourism. Still things to do and see, if you are willing to brave the heat. The hostel was quite good - simply a modified apartment run by an italian couple, but it was a good price, had working aircon, and for a reasonable fee we could make use of the kitchen for cooking.

We went to the Volcano, Etna, yesterday. Absolutely amazing. We went right to the top, and looked into the big crater. We had perfect weather and volcanic conditions. We could see a long way down, because the gases weren't too thick. Smelt awful though. The whole volcano was like a black desert. In some places, you'd sink 30cm or more into the "sand" when walking.

28. August

Syracuse good. Taormina touristy. We're in Catania since yesterday.

18. August

Bit of a gap in my writings, but here goes. Palermo was great, but we spent too long there, and/or didn't take advantage of the nearby opportunities there.

We found a nice cheap outdoor restaurant where we treated our taste buds to many sicilian specialties. We ate there almost daily, and said an almost teary goodbye to our regular waiter, Vincenzo, the day before we left.

The shopping opportunities are quite good there. There are some nice beaches just outside of Palermo, which we failed to visit.

Trapani was pleasant. We changed from our out of the way hostel to a hotel at the last minute, and from then on Trapani was great. We went to the small island of Levanzo first, lost the trail trying to find the main grotto there, so backtracked and found our way to a smaller grotto, where we swam and took in some sun before heading to one of the very few local restaurants/bars, where we ate pizza before catching the ferry back.

The second day in Trapani we visited the hilltop city of Erice, and the ruins of the temple there, before returning to the city, catching the afternoon sun and watching the sunset with our plastic cups full of red wine, and finally a walk through the city in the evening.

Because Saturday, August 15. was a public holiday, we opted to take a train back to Palermo, and then down to Agrigento instead of taking the one and only bus in the evening.

Agrigento failed initially to make a good impression, largely to do with the public holiday and sunday, and the initially malfunctioning fan in the room (we had it replaced at 11pm when we couldn't sleep and I went to find the hostelkeeper with murderous thoughts, but he had a spare, lucky for him) Our local take away pizza store did make excellent pizza, though, so we enjoyed that the first night on a nearby bench overlooking the all-but deserted street and some trashcans. Luckily we were in good company. On Sunday we visited the Valley of the Temples, which was indeed impressive. Amazingly well preserved. A little warm, though, as most of this holiday has been so far. We went to the beach afterwards, but didn't want to swim or set foot on the sand until later in the day, so we walked for a bit, eventually settling for a little beachside cafe with umbrellas. They have chip-patties in Sicily. Oh how I've missed them.

The second day we wanted to visit "le scale dei turchi" (the turkish steps), and assumed it woud be an easy trip. After chilling in the morning, we caught a bus to Realmonte, then we walked for 1 hour in the midday-sun to the stairs, because the next bus was still 1.5 hours away and we were told it would take 30 minutes. There were no cafe's in-between to buy more water, but it was mostly downhill. We made it, drank lots of water, took some photos on the steps, waded in the ocean, and then decided we didn't have time to stay longer if we had to walk back too, so went on our way. 10 minutes out we asked a man on a motorbike if he knew the number for a taxi service. He told us there was no service because it's such a small town, but he called a friend of his with a car and negotiated a fee. 25 minutes later we were enjoying a beer at the caffé next to the bus stop, with 40 minutes to spare until the last bus back to Agrigento. The bus came late, and our taxi driver stopped on his motorbike to see if everything was ok, but we made it back ok. So - Agrigento is good for public transport to the temples, and ok to its beaches, but you want a car for anything else. A motorbike would be ok too, but don't expect to be able to hire one there.

Right now we're on a train to Catania, and we'll catch another train later to Syracuse. The hotel looks ok, but we'll see!

At the Hotel. It looks great! The aircon's on and we'll shower before taking off to explore the old city at night. I love places like this. New plan - if the hostels aren't significantly less than hotels, just stay at a hotel!

7. August

First day in Palermo was a success. It was a bit of a walk from the port to the hostel - different port than we thought. But we walked it anyway, getting directions from friendly natives.

— by Robert Thomson, created 2nd Sep, 2009, last modified 11th Sep, 2009 | Tags: World