Monday, June 16th, 2008...1:38 pm
Gencal Syntax Change?
I’m investigating possible syntax changes for Gencal’s template tag having been directed to this post by James Bennett via Marco in a previous post. My thoughts are to split it up into two template tags. A simple template tag which will render one model’s object and a more complex tag (with requisite views) which will allow the importing of multiple objects across many models.
The syntax I’m considering for the simple model is:
{% gencal for Base.Model on date_field in DateObject %}
The grammatical words aren’t set in stone by any means. Jannis, for instance, thinks I shouldn’t use the `in` keyword as its used in other portions of the template language. This would allow someone to quickly and easily create a generic calendar for an object without a big investment. From a syntax standpoint, it also makes it much easier to set up.
The downside of this approach is your calendar will only hold one object (which is probably just fine for most people). The second option is mostly what I’m doing now. Generate a list of objects to map and pass them into the template. There is some documentation work that needs to be done on this front, which I’ll be doing as I use gencal in an upcoming project.
Also speaking of choices, I’m looking to create two different default templates. One which will include a detailed listing of what’s going on in a month (similar to iCal) and another which will tell you if there is an event on a specific day (typically seen by bolding the day). The first one would be a large calendar (700px ish), while the second would be much smaller (100px-ish). Interested to hear your thoughts on these proposed changes as I look to make improvements to gencal this week.






2 Comments
July 3rd, 2008 at 2:48 pm
Just curious, what did you end up doing? Are you going to refactor the syntax?
July 3rd, 2008 at 3:00 pm
In case you couldn’t tell, I’m horrific about updating my blog. I’ve got some plans in the work to fix that. Anyhow, I have in fact refactored the syntax, but in a different tag (called simple_gencal) in order to preserve existing functionality. I have it currently mangled with a client project but I’ll pull it out this sometime next week as there are some error checking that I need to build in.
Leave a Reply