In still other news, I’ve been playing with django’s newforms module for creating forms on the websites I’ve got in the pipeline. It looks like the StreamBase website will finally be content-managed, though not by django, but by something else. I’m hard at work on getting the website for Aimee going. This weekend will be a ReaportLab weekend for me. There are some documents on the church site that will be in both web-readable and PDF-able form. I have this notion that I can do both, though I admit to that being somewhat hopeful. We’ll see.
Before I even do that, I have to do major cleanup on the code already written. It’s funny to see how my knowledge of Django has evolved in the last few months. I’m going back in, currently, to do some DRY’ing of a lot of the stuff in there — gosh I repeated myself! But it was intentional, just to get functionality going — I knew I’d go back in and clean up. And here I am on the other side of that. I’m not complaining at all, mind you, because I feel like I’ve learned a lot when I look at that old code.
I’ll share one of the long-standing issues I’m having. The church has a calendars page which shows upcoming and past weekly schedules. Being a church, they have services every Sunday. During the week and in other rooms/halls they have other meetings (Rotary Club, etc). So, the calendars page needs to show all of those. I opted for this approach in the end: a BaseEvent which holds the date, the title and slug information and description field. The Event object has a one-to-one relationship, and it has fields for frequency and timetables (Timetables are a separate model, so they’re foreign-keyed into the Event). The Service object holds the information on the priest, the crucifers, foreign key to the Sermons, etc, and it also has a foreign keys to the Timetable. If there’s enough interest, I’ll put up that file for you all to see and critique. I definitely have not gotten it right, so I’m glad of any input.
So the idea is that a request to the /events/ URL shows the archive of most recent and immediately upcoming events and services. The same with /events/yyyy, /events/yyyy/mmm/ and /events/yyyy/mmm/dd. So the query dictionary has to include all of them, reversed-ordered by date. A request to the /services/ URL is obviously a filtered query, and the like. Now, when you click on a specific event, it either goes to /events/yyyy/mmm/dd/event-name or to /services/yyyy/mmm/dd/service-name. That’s the motivation for all this. If there’s a better way you can think of, please drop me a comment. I’m definitely interested in the opinions of you ruby and rubyonrails people.