コード例 #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
コード例 #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()
コード例 #3
0
ファイル: activity.py プロジェクト: yledoare/autonomie
    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()
コード例 #4
0
ファイル: activity.py プロジェクト: yledoare/autonomie
 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)
コード例 #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)
コード例 #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
コード例 #7
0
ファイル: activity.py プロジェクト: yledoare/autonomie
 def record_form(self):
     """
     Return a form for recording the activity informations
     This form's submission will be handled in the ajax_submission page
     """
     submit_url = self.request.route_path(
         "activity",
         id=self.request.context.id,
         _query=dict(action="record"),
     )
     form = deform.Form(
         schema=RecordActivitySchema().bind(request=self.request),
         buttons=(ACTIVITY_RECORD_BUTTON, ACTIVITY_CANCEL_BUTTON,),
         counter=self.counter,
         formid="record_form",
         action=submit_url,
     )
     form.set_appstruct(self.get_appstruct())
     auto_need(form)
     return form.render()
コード例 #8
0
ファイル: workshop.py プロジェクト: w3bcr4ft/autonomie
    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
コード例 #9
0
ファイル: workshop.py プロジェクト: Swannbm/autonomie
    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
コード例 #10
0
 def record_form(self):
     """
     Return a form for recording the activity informations
     This form's submission will be handled in the ajax_submission page
     """
     submit_url = self.request.route_path(
         "activity",
         id=self.request.context.id,
         _query=dict(action="record"),
     )
     form = deform.Form(
         schema=RecordActivitySchema().bind(request=self.request),
         buttons=(
             ACTIVITY_RECORD_BUTTON,
             ACTIVITY_CANCEL_BUTTON,
             ACTIVITY_PDF_BUTTON,
         ),
         counter=self.counter,
         formid="record_form",
         action=submit_url,
     )
     form.set_appstruct(self.get_appstruct())
     auto_need(form)
     return form.render()
コード例 #11
0
ファイル: workshop.py プロジェクト: w3bcr4ft/autonomie
 def before(self, form):
     auto_need(form)
     timepicker_fr.need()
     default_timeslots = get_default_timeslots()
     form.set_appstruct({'timeslots': default_timeslots})
コード例 #12
0
 def before(self, form):
     BaseEditView.before(self, form)
     auto_need(form)
     form.widget = AccordionFormWidget(named_grids=FORM_GRID)
コード例 #13
0
 def before(self, form):
     auto_need(form)
     form.widget = AccordionFormWidget(named_grids=USERDATAS_FORM_GRIDS)
     self.populate_actionmenu()
コード例 #14
0
ファイル: workshop.py プロジェクト: Swannbm/autonomie
 def before(self, form):
     auto_need(form)
     timepicker_fr.need()
     default_timeslots = get_default_timeslots()
     form.set_appstruct({'timeslots': default_timeslots})
コード例 #15
0
 def before(self, form):
     BaseEditView.before(self, form)
     auto_need(form)
     form.widget = AccordionFormWidget(named_grids=FORM_GRID)
コード例 #16
0
 def before(self, form):
     auto_need(form)
     form.widget = AccordionFormWidget(named_grids=USERDATAS_FORM_GRIDS)
     self.populate_actionmenu()