>
> So in your Event model (or whatever you're calling it), you're
> essentially storing the keyword arguments to an rrule, depending on
> what's necessary for a particular event?
>
> Then whenever you need to render a calendar, you pull in all the
> Events from the db, create rrules for each using the stored
> parameters, and just work with the dateutil library to do the rest?
>
> Jay P.
More or less, yes.
I have a Django model (from my original test code):
class ResourceSchedule(models.Model):
description = models.CharField(maxlength=64)
daymap = models.IntegerField()
monthmap = models.SmallIntegerField(default=4095)
period =
models.SmallIntegerField(default=0,choices=RESOURCE_SCHEDULE_PERIODS,validator_list=[validators.NumberIsInRange(0,6)])
frequency = models.SmallIntegerField(default=1)
time_from = models.TimeField(default='09:00:00')
duration = models.TimeField(default='00:30:00')
date_from = models.DateField()
date_to = models.DateField(null=True)
Which covers all the rule bits I will need.
The daymap and monthmap are used depending on what the period is (Weekly,
Monthly etc.) to store exactly wich days & months the event should repeat
in. I store these as a bitmap for minimizing data storage, but it is
easily searchable with SQL and the bitmaps can be simply expanded to lists
for display in forms (as Checkbox Lists for example). You could of course
store the days/months more explicitly in your table.
frequency is the interval part of the rule giving you every 'n' weeks for
example.
Its pretty easy to then find the ResourceSchedules that might be
candidates for having events in your datefrom/dateto period and shoving
them into and rrule/rruleset.
It might be overkill for some simple tasks but I need the flexibility.
This way I can store/generate just about any repeating pattern I care to
think of.
Regards,
Gary.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---