On Mon, Jan 14, 2013 at 09:41:47AM +1100, Mario Gudelj wrote:
> Defined my own. Actually, i have defined a single appointment/event model
> and then i create an instance of it with different dates and different slug
> for the range specified.
> 
> Use rrlue -
> http://labix.org/python-dateutil#head-470fa22b2db72000d7abe698a5783a46b0731b57
> to
> calculate the date and time for every date i the range.
> 
> So, this how I did it, but you may find a different way.
> 
> I have an appointment model and appointment series which is linked to the
> appointment model.
> 
> I have an appointment creation form, which can create a single appointment,
> but the customer also has an option to create recurring appointments, which
> will create series.
> 
> So, customer is filling in the form and they are asked if this is a
> recurring appointment. I they select yes it presents them with the
> following screen:
> 
> 
> [image: Inline images 1]
> 
> 
> There they can choose if they want the event to recur daily, monthly,
> weekly or yearly.
> 
> So, when the form is submitted with the interval selected, I create the
> appointment, create appointment series and then use rrule to create all the
> dates.
> 
> if form.cleaned_data['is_recur'] == '1':
> 
>         # Find the interval first
> 
>         frequency_int = int(form.cleaned_data['frequency'])
> 
>         if frequency_int == rrule.DAILY:
> 
>             interval = form.cleaned_data['daily_interval']
> 
>         elif frequency_int == rrule.WEEKLY:
> 
>             interval = form.cleaned_data['weekly_interval']
> 
>         elif frequency_int == rrule.MONTHLY:
> 
>             interval = form.cleaned_data['monthly_interval']
> 
>         else:
> 
>             interval = form.cleaned_data['yearly_interval']
> 
> Then I loop through all the dates created by rrule and create an
> appointment instance with a different date and the slug, which is the
> combination of appointment name and the date/time.
> 
> e.g. slug
> /appointment/pregnancy-yoga-dads-support-people-welcome/2013/1/23/0630PM/
> 
> In appointment series I store this info:
> 
> a_s = AppointmentSeries.objects.create(
> 
>                     business=business,first_appointment=appt,
> 
>                     frequency=form.cleaned_data['frequency'],
> 
>                     is_date_or_number =
> form.cleaned_data['is_date_or_number'],
> 
>                     recurrences=form.cleaned_data['recurrences'],
> 
>                     recurrence_end_date=None,
> 
>                     interval=interval
> 
>                 )
> 
> You need to save the first appointment from which everything was created so
> that you can later refer to it when editing the series.
> 
> Anyway, let me know if you need further info and I'm willing to help.
> 
> You may want to look at this post for fullcalendar.js and backbone.js
> integration. It helped me somewhat -
> http://blog.shinetech.com/2011/08/05/building-a-shared-calendar-with-backbone-js-and-fullcalendar-a-step-by-step-tutorial/

Thanks a lot, Mario. It is a lot of information and it is great. I like the
approach. I'm already coding something like that, althoug your use of
recurrences is cleaner. :)

                Iñigo

> 
> Cheers,
> 
> Mario
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 13 Jan, 2013 11:33 PM, "Iñigo Medina" <imed...@grosshat.com> wrote:
> 
> >
> > On Sun, Jan 13, 2013 at 12:44:27PM +1100, Mario Gudelj wrote:
> > > It was straight forward. Tastypie makes it really easy to talk json to
> > > backbone and plotting the appointments in fullcalendar was even easier.
> > You
> > > can have the basic functinality in couple of days. More challenging are
> > the
> > > recurring appointments but python's rrule was great help there.
> >
> > I'm going to code a kind of calendar too. I'm still thinking on a good
> > approach
> > for the recurring appointments at the data model level. Are you using any
> > app
> > for that? Or did you define your own data model?
> >
> >                 Iñigo
> >
> > > On 13 Jan, 2013 9:01 AM, "william ratcliff" <william.ratcl...@gmail.com>
> > > wrote:
> > >
> > > > How did you find the integration?
> > > >
> > > > William
> > > >
> > > >
> > > > On Sat, Jan 12, 2013 at 4:52 PM, Mario Gudelj <mario.gud...@gmail.com
> > >wrote:
> > > >
> > > >> I don't think there is one. I looked for one few months ago and ended
> > up
> > > >> building one from scratch with fullcaledar.js, backbone and tastypie
> > > >>  On 12 Jan, 2013 6:00 PM, "Kashif Ali" <kashi.az...@gmail.com> wrote:
> > > >>
> > > >>> Hello Guys,
> > > >>>
> > > >>> Is there any django app available that is a replica of google
> > calendar?
> > > >>> I have checked django-scheduler, django-swingtime and couple of more
> > but
> > > >>> the hardest part with these apps/projects is the limited
> > documentation.
> > > >>> Can anybody please guide me what app can serve my purpose?
> > > >>>
> > > >>> Thanks,
> > > >>> Kashif
> > > >>>
> > > >>> --
> > > >>> You received this message because you are subscribed to the Google
> > > >>> Groups "Django users" group.
> > > >>> To post to this group, send email to django-users@googlegroups.com.
> > > >>> To unsubscribe from this group, send email to
> > > >>> django-users+unsubscr...@googlegroups.com.
> > > >>> For more options, visit this group at
> > > >>> http://groups.google.com/group/django-users?hl=en.
> > > >>>
> > > >>  --
> > > >> You received this message because you are subscribed to the Google
> > Groups
> > > >> "Django users" group.
> > > >> To post to this group, send email to django-users@googlegroups.com.
> > > >> To unsubscribe from this group, send email to
> > > >> django-users+unsubscr...@googlegroups.com.
> > > >> For more options, visit this group at
> > > >> http://groups.google.com/group/django-users?hl=en.
> > > >>
> > > >
> > > >  --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > > http://groups.google.com/group/django-users?hl=en.
> > > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to