code

Django MultiRangeField and MultiRangeFormField

I’m building a website, and needed a way to save a list of pages and page ranges from a book or magazine. I wanted to to be a little more strict than just saving it as a string without any cleanup or validation, so I wrote a custom Django model field (and accompanying form field).

It either just validates and cleans so that

[crayon-64cc43bdc827f065817020/]

becomes the tidy

[crayon-64cc43bdc8284268839215/]

…or, if you comment out the raising of the ValidationError in the form field’s validate() method, it will actually clean up any junk characters for you, so even this horrible mess:

[crayon-64cc43bdc8286559892587/]

gets cleaned to

[crayon-64cc43bdc8288635303413/]

Enjoy!

FeedPress Subscribers for Panic Status Board

Since the launch of my new podcast, I’ve been trying to keep track of stats on podcast downloads and subscribers. FeedPress has been my feed tracker of choice recently, and seems to work very smoothly (even if they only update stats once a day).

I’m also a big fan of Panic’s Status Board iPad app for keeping track of all sorts of stats — so much so that I’m considering getting a dedicated (old, used) iPad, just to hook up to a big monitor and display stats all day.

These are obviously two great tastes that taste great together, as FeedPress already supplies a JSON file that you can load into Status Board to see 7 days worth of subscriber data for a single feed. But what if you want to see more days? Or more than one feed? That’s where my Python script comes in.

Feedpress Subscribers Status Board Graph Panel

Yeah, it’s a mouthful, but at least it’s descriptive. You can download it on Github. Full instructions are included in the repository, and here, in my scripts page.