Calendar with more than one model

Is it possible to create a calendar tool that holds the information for more than one model type?

Hi Bart,

The calendar-widget(s) typically source data directly from a single model. These types of scenarios can usually be solved with the right data-modelling. If you give me some further details on what you are trying to do I can give you some pointers / ideas.

Thanks,

/Johan/

Thanks Johan,

I’m trying to create a calendar for a series of classes and exams, where “Classes” and “Exams” are both different model types.

Hi Bart,

Here are two ways to solve this by modelling:

  1. Have a generic model called “Event” (or similar) and make it have a required state-attribute called “Type” (which can be either “Class” or “Exam”).
  2. Have a common model “Event” and optional 1 - 0…1 relations to Class and Exam.
  3. It’s also possible that a combination of both #1 and #2 could be beneficial.

Either way you would bind your calendar-widget to the Event-model and then format the events in a way that they are easy to tell apart (if needed). You could also easily filter for one or the other kind in other views.

Thanks,

/Johan/