At the moment we are developing the app in a private SVN server, but I
think that we are gonna release the project on January-February (more
or less), and if nothing changes, it will be open source.

Anyway, i'll speak with the other developer on the next monday about
this.

best regards

On 4 nov, 20:09, Richard Vézina <ml.richard.vez...@gmail.com> wrote:
> Hello!
>
> I am very interresting in your dev.
>
> I would like to help if possible.
>
> Richard
>
> On Thu, Nov 4, 2010 at 2:16 PM, demetrio <dgzabal...@gmail.com> wrote:
> > Hi everyone!
>
> > I'm doing an app with fullcalendar (http://arshaw.com/fullcalendar/)
> > and now i'm with all the events and calendar cruds.
>
> > Its time to add some logic to the crud.create() of the events, an only
> > let the user to add events in his/her calendars, not in ALL the
> > calendars.
>
> > I have this:
>
> > db.define_table('calendars',
> >    Field('name', 'string', required=True, notnull=True),
> >    #Field('project_id', 'reference', default=None, required=True),
> >    format='%(name)s')
>
> > db.define_table('events',
> >    Field('title', 'string', required=True, notnull=True,
> > label=T('Title')),
> >    Field('place', 'string', label=T('Place')),
> >    Field('description', 'text', label=T('Description')),
> >    Field('init_date', 'datetime', required=True, label=T('Init
> > date')),
> >    Field('end_date', 'datetime', required=True, label=T('End date')),
> >    Field('calendar_id', 'reference calendars', label=T('Calendar')),
> >    Field('all_day', 'boolean', default=False, required=True,
> > label=T('All day')),
> >    format='%(title)s'
> >    )
>
> > db.define_table('user_calendars',
> >    Field('calendar', 'reference calendars', required=True,
> > notnull=True, label=T('Calendar')),
> >    Field('color', 'string', default="blue", required=True,
> > label=T('Color')),
> >    Field('fullcalendar_class', 'string', required=True,
> > writable=False, readable=False),
> >    Field('permissions', 'string', required=True,
> > label=T('Permissions'), requires=IS_IN_SET(['r', 'rw', 'owner'],
> > zero=None)),
> >    Field('user_id', 'reference auth_user', required=True,
> > notnull=True, label=T('User')),
> >    format='')
>
> > With that model defined, in the events crud, will appear ALL the
> > calendars, so i have tried to do something like this:
>
> > def create():
> >    query = ((db.user_calendars.calendar == db.calendars.id)  &
> > (db.user_calendars.user_id == auth.user.id)  &
> > ((db.user_calendars.permissions =="owner") |
> > (db.user_calendars.permissions=="rw")))
> >    db.events.calendar_id.requires =IS_IN_DB(db, query, zero=None )
> >    return dict(form=crud.create(db.events))
>
> > And i found that the IS_IN_DB doesn't admit SQL queries xD
>
> > the query is something like: "give me all my calendars and the ones
> > where i can write"
>
> > Is there any "quick" and optimal solution to make all of this in the
> > controller? or i have to customize the crud form in the view?.
>
> > Thanks in advance!
>
>

Reply via email to