Esempio n. 1
0
    def before(self, form):
        """
        Populate the form before rendering

            form

                The deform form object used in this form view (see parent class
                in pyramid_deform)
        """
        populate_actionmenu(self.request)
        auto_need(form)
        timepicker_fr.need()

        appstruct = self.context.appstruct()
        participants = self.context.participants
        appstruct['participants'] = [p.id for p in participants]

        trainers = self.context.trainers
        appstruct['trainers'] = [p.id for p in trainers]

        timeslots = self.context.timeslots
        appstruct['timeslots'] = [t.appstruct() for t in timeslots]

        try:
            appstruct['owner'] = appstruct['owner'].id
        except KeyError:
            pass

        form.set_appstruct(appstruct)

        if not self.request.has_permission('edit_owner.event'):
            form['owner'].widget.readonly = True

        return form
Esempio n. 2
0
    def before(self, form):
        """
        fill the form before it will be handled
        """
        populate_actionmenu(self.request)
        self.counter = form.counter
        appstruct = self.get_appstruct()
        form.set_appstruct(appstruct)

        auto_need(form)
        timepicker_fr.need()
Esempio n. 3
0
    def before(self, form):
        """
        fill the form before it will be handled
        """
        populate_actionmenu(self.request)
        self.counter = form.counter
        appstruct = self.get_appstruct()
        form.set_appstruct(appstruct)

        auto_need(form)
        timepicker_fr.need()
Esempio n. 4
0
 def before(self, form):
     """
     By default the activity is filled with the current user as conseiller
     """
     auto_need(form)
     timepicker_fr.need()
     come_from = self.request.referrer
     current_user = self.request.user
     appstruct = {
         'conseillers': [current_user.id],
         'come_from': come_from,
     }
     form.set_appstruct(appstruct)
Esempio n. 5
0
 def before(self, form):
     """
     By default the activity is filled with the current user as conseiller
     """
     auto_need(form)
     timepicker_fr.need()
     come_from = self.request.referrer
     current_user = self.request.user
     appstruct = {
         'conseillers': [current_user.id],
         'come_from': come_from,
     }
     form.set_appstruct(appstruct)
Esempio n. 6
0
    def before(self, form):
        auto_need(form)
        timepicker_fr.need()
        default_timeslots = get_default_timeslots()
        form.set_appstruct({
            'timeslots': default_timeslots,
            'owner': self.request.user.id,
        })

        if not self.request.has_permission('edit_owner.event'):
            form['owner'].widget.readonly = True

        # Default to current user
        if not form['owner'].cstruct:
            form['owner'].cstruct = self.request.user.id
Esempio n. 7
0
    def before(self, form):
        """
        Populate the form before rendering

            form

                The deform form object used in this form view (see parent class
                in pyramid_deform)
        """
        populate_actionmenu(self.request)
        auto_need(form)
        timepicker_fr.need()

        appstruct = self.context.appstruct()
        participants = self.context.participants
        appstruct['participants'] = [p.id for p in participants]

        timeslots = self.context.timeslots
        appstruct['timeslots'] = [t.appstruct() for t in timeslots]

        form.set_appstruct(appstruct)
        return form
Esempio n. 8
0
    def before(self, form):
        """
        Populate the form before rendering

            form

                The deform form object used in this form view (see parent class
                in pyramid_deform)
        """
        populate_actionmenu(self.request)
        auto_need(form)
        timepicker_fr.need()

        appstruct = self.context.appstruct()
        participants = self.context.participants
        appstruct['participants'] = [p.id for p in participants]

        timeslots = self.context.timeslots
        appstruct['timeslots'] = [t.appstruct() for t in timeslots]

        form.set_appstruct(appstruct)
        return form
Esempio n. 9
0
 def before(self, form):
     auto_need(form)
     timepicker_fr.need()
     default_timeslots = get_default_timeslots()
     form.set_appstruct({'timeslots': default_timeslots})
Esempio n. 10
0
 def before(self, form):
     auto_need(form)
     timepicker_fr.need()
     default_timeslots = get_default_timeslots()
     form.set_appstruct({'timeslots': default_timeslots})