Пример #1
0
 def _get_field(self, management=False):
     from indico.modules.events.contributions import get_contrib_field_types
     try:
         impl = get_contrib_field_types()[self.field_type]
     except KeyError:
         return None
     return impl(self, management=management)
Пример #2
0
 def _process_args(self):
     RHManageContributionsBase._process_args(self)
     field_types = get_contrib_field_types()
     try:
         self.field_cls = field_types[request.view_args['field_type']]
     except KeyError:
         raise NotFound
Пример #3
0
 def _get_field(self, management=False):
     from indico.modules.events.contributions import get_contrib_field_types
     try:
         impl = get_contrib_field_types()[self.field_type]
     except KeyError:
         return None
     return impl(self, management=management)
Пример #4
0
 def _process_args(self):
     RHManageContributionsBase._process_args(self)
     field_types = get_contrib_field_types()
     try:
         self.field_cls = field_types[request.view_args['field_type']]
     except KeyError:
         raise NotFound
Пример #5
0
 def _checkParams(self, params):
     RHManageContributionsBase._checkParams(self, params)
     field_types = get_contrib_field_types()
     try:
         self.field_cls = field_types[request.view_args['field_type']]
     except KeyError:
         raise NotFound
Пример #6
0
 def _checkParams(self, params):
     RHManageContributionsBase._checkParams(self, params)
     field_types = get_contrib_field_types()
     try:
         self.field_cls = field_types[request.view_args['field_type']]
     except KeyError:
         raise NotFound
Пример #7
0
 def _process(self):
     custom_fields = self.event.contribution_fields.order_by(
         ContributionField.position)
     custom_field_types = sorted(get_contrib_field_types().values(),
                                 key=attrgetter('friendly_name'))
     return jsonify_template(
         'events/contributions/management/fields_dialog.html',
         event=self.event,
         custom_fields=custom_fields,
         custom_field_types=custom_field_types)
Пример #8
0
 def _process(self):
     field_class = get_contrib_field_types()[self.contrib_field.field_type]
     form = field_class.create_config_form(obj=FormDefaults(self.contrib_field, **self.contrib_field.field_data))
     if form.validate_on_submit():
         old_title = self.contrib_field.title
         self.contrib_field.mgmt_field.update_object(form.data)
         db.session.flush()
         self.event.log(EventLogRealm.management, EventLogKind.change, 'Contributions',
                        'Modified field: {}'.format(old_title), session.user)
         return jsonify_data(flash=False)
     return jsonify_template('events/contributions/forms/contribution_field_form.html', form=form)
Пример #9
0
 def _process(self):
     custom_fields = self.event.contribution_fields.order_by(ContributionField.position)
     custom_field_types = sorted(get_contrib_field_types().values(), key=attrgetter('friendly_name'))
     return jsonify_template('events/contributions/management/fields_dialog.html', event=self.event,
                             custom_fields=custom_fields, custom_field_types=custom_field_types)