python - How to use django-scheduler app in existing app -


i looking django apps handle task calendar kind of event , django-schedule example project provides sample project dont know how map task class (title & starttime) event class of django schedule. documentation doesn't make clear how can that? apprciate if pointers or steps can provided here use django-schedule app existing app

the solution here using django scheduler app own models present not able make out of it. looking tutorial on how hook django-scheduler own model

found conversation on internet https://groups.google.com/forum/#!topic/pinax-users/9norwjmdiym , reference explain logic below:

  1. assume task class having startdatetime & enddatetime & title
  2. from schedule.models import event, eventrelation, calendar ( coming schedule app)
  3. override save method of task object create new event below , modified code provided in link above make clearer
  4. the code looks existing calendar , attaches event linked task object via relationship
  5. tried code below extend project-sample app provided source , 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 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 search extending click functionality on calendar event gives text box , how customize hyper link remains seen code above answers question , part of problem


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -