Is it possible to create a calendar tool that holds the information for more than one model type?
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.
I’m trying to create a calendar for a series of classes and exams, where “Classes” and “Exams” are both different model types.
Here are two ways to solve this by modelling:
- 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”).
- Have a common model “Event” and optional 1 - 0…1 relations to Class and Exam.
- 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.