On Friday, May 12, 2017 at 11:54:08 AM UTC-7, Andrea Fae' wrote:
>
> Hey guys...I know there are gurus of web2py...no suggestion? Please help 
> me...
> thank you 
>
>  
>
Il giorno giovedì 11 maggio 2017 21:40:42 UTC+2, Andrea Fae' ha scritto:
>>
>> Hello, I have a form that in this moment create one record in the 
>> database. This records represent an event:
>>
>> db.define_table('evento',
>>                 Field('titolo', requires=[IS_NOT_EMPTY()]),
>>                 Field('inizio', type='datetime'),
>>                 Field('fine', type='datetime'),
>>                 Field.Virtual('giorno_inizio', lambda 
>> row:calendar.day_name[row.evento.inizio.weekday()]),
>>                 Field('risorsa', 'reference risorsa'),
>>                 Field('docente', 'reference auth_user'),
>>                 Field('materia', 'reference materia'),
>>                 Field('studenti', 'list:reference auth_user'),
>>                 Field('colore', default = '#8080ff'),
>>                 
>> auth.signature,singular="Evento",plural="Eventi",migrate='evento.table',
>>                 format='%(titolo)s')
>>
>> This event has start time and end time. 
>> For accepting the form I use  "if form.process().accepted:".
>>
>> All is working perfectly, But if I want to create a recurring event for 
>> example adding a dropdown box that user can select for how many week I have 
>> to repeat the event. (for example the same event every Tuesday from 10:00 
>> to 11:00 for 5 weeks), how ca I do? How to insert multiple record in the 
>> database using only one form?
>>
>>

I would simply add a field to your table to record the repeat information, 
and that puts it into your form automagically (for SQLFORM, at least).  
That's how it's down in many calendar programs (viz Google Calendar), and 
the ICS/VCS invitation files have a specified format for representing that 
information.  These are, basically, a string with start date/time ("DTSTART"), 
and a string to specify the rule that generates the repitition ("RRULE") , 
and optionally an end date ("DTEND", IIRC).

You can choose to make your repeat field a rule if that's what you want, or 
you could just have a list of dates (if there aren't too many repeats).

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to