I am looking for django apps to handle Task Calendar kind of event and django-schedule example project provides a sample project but I dont know how to map the my Task class (title & startTime) with the event class of django schedule. Documentation doesn't make it clear how can I do that? Will really apprciate if some pointers or steps can be provided here to use django-schedule app with an existing app
The solution here Using the Django scheduler app with your own models is present but I am not able to make much out of it. I am looking for some tutorial on how to hook django-scheduler to my own model
Found this good conversation on internet https://groups.google.com/forum/#!topic/pinax-users/9NoRWjMdiyM and with as reference will explain the logic as below:
Tried the code below to extend the Project-Sample app provided with the source and it worked fine
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 have to search for extending the Click functionality on the Calendar event which currently gives a text box , how to customize that with a hyper link remains to be seen but the code above answers the question and part of the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With