Found this good conversation on the Internet https://groups.google.com/forum/#!topic/pinax-users/9NoRWjMdiyM , and the logic will be explained as a reference, as shown below:
- Suppose your task class has startDateTime and endDateTime and Title
- from schedule.models import Event, EventRelation, Calendar (from Schedule application)
- Cancel the method of saving the Task object to create a new event, as shown below, change the code specified in the link above to make it more understandable.
- The code searches for an existing Calendar and attaches an event to it that is associated with the Task object through a relationship
Tried the code below to extend the Project-Sample application that comes with the source and it works great
def save(self, force_insert=False, force_update=False): new_task = False if not self.id: new_task = True super(Task, self).save(force_insert, force_update) end = self.startDateTime + timedelta(minutes=24*60) title = "This is test Task" if new_task: event = Event(start=self.startDateTime, end=end,title=title, description=self.description) event.save() rel = EventRelation.objects.create_relation(event, self) rel.save() try: cal = Calendar.objects.get(pk=1) except Calendar.DoesNotExist: cal = Calendar(name="Community Calendar") cal.save() cal.events.add(event) else: event = Event.objects.get_for_object(self)[0] event.start = self.startDateTime event.end = end event.title = title event.description = self.description event.save()
Still, you need to look for the Click function extension in the Calendar event, which currently provides a text field, how to configure it with a hyperlink is not yet visible, but the code above answers the question and part of the problem.
source share