Пример #1
0
def _render_template_list(target, event=None):
    tpl = get_template_module('designer/_list.html')
    default_template = get_default_template_on_category(target) if isinstance(target, Category) else None
    not_deletable = get_not_deletable_templates(target)
    return tpl.render_template_list(target.designer_templates, target, event=event, default_template=default_template,
                                    inherited_templates=get_inherited_templates(target),
                                    not_deletable_templates=not_deletable)
Пример #2
0
def _render_template_list(target, event):
    tpl = get_template_module('designer/_list.html')
    return tpl.render_template_list(
        target.designer_templates,
        target,
        event=event,
        inherited_templates=get_inherited_templates(target))
Пример #3
0
def _render_template_list(target, event=None):
    tpl = get_template_module('designer/_list.html')
    default_template = get_default_template_on_category(target) if isinstance(target, Category) else None
    not_deletable = get_not_deletable_templates(target)
    return tpl.render_template_list(target.designer_templates, target, event=event, default_template=default_template,
                                    inherited_templates=get_inherited_templates(target),
                                    not_deletable_templates=not_deletable)
Пример #4
0
 def _process(self):
     inherited_templates = [tpl for tpl in get_inherited_templates(self.target)
                            if not tpl.backside_template and tpl.type == TemplateType.badge]
     custom_templates = [tpl for tpl in self.target.designer_templates
                         if not tpl.backside_template and tpl != self.template and tpl.type == TemplateType.badge]
     return jsonify_template('designer/backside_list.html', target=self.target, custom_templates=custom_templates,
                             inherited_templates=inherited_templates, current_template=self.template,
                             width=int(request.args['width']), height=int(request.args['height']))
Пример #5
0
 def _process(self):
     inherited_templates = [tpl for tpl in get_inherited_templates(self.target)
                            if not tpl.backside_template and tpl.type == TemplateType.badge]
     custom_templates = [tpl for tpl in self.target.designer_templates
                         if not tpl.backside_template and tpl != self.template and tpl.type == TemplateType.badge]
     return jsonify_template('designer/backside_list.html', target=self.target, custom_templates=custom_templates,
                             inherited_templates=inherited_templates, current_template=self.template,
                             width=int(request.args['width']), height=int(request.args['height']))
Пример #6
0
    def _process(self):
        all_templates = set(
            self.event.designer_templates) | get_inherited_templates(
                self.event)
        badge_templates = {
            tpl.id: {
                'data':
                tpl.data,
                'backside_tpl_id':
                tpl.backside_template_id,
                'orientation':
                'landscape'
                if tpl.data['width'] > tpl.data['height'] else 'portrait',
                'format':
                self._get_format(tpl)
            }
            for tpl in all_templates if tpl.type.name == 'badge'
        }
        settings = event_badge_settings.get_all(self.event.id)
        form = BadgeSettingsForm(self.event,
                                 template=self.template_id,
                                 **settings)
        registrations = self.registrations or self.regform.registrations
        if self.event.is_locked:
            del form.save_values

        if form.validate_on_submit():
            data = form.data
            if data['page_layout'] == PageLayout.foldable:
                data['top_margin'] = 0
                data['bottom_margin'] = 0
                data['left_margin'] = 0
                data['right_margin'] = 0
                data['margin_columns'] = 0
                data['margin_rows'] = 0
                data['dashed_border'] = False
            data.pop('submitted', None)
            template_id = data.pop('template')
            if data.pop('save_values', False):
                event_badge_settings.set_multi(self.event, data)
            data['registration_ids'] = [x.id for x in registrations]

            key = unicode(uuid.uuid4())
            badge_cache.set(key, data, time=1800)
            download_url = url_for('.registrations_print_badges',
                                   self.regform,
                                   template_id=template_id,
                                   uuid=key)
            return jsonify_data(flash=False,
                                redirect=download_url,
                                redirect_no_loading=True)
        return jsonify_template(
            'events/registration/management/print_badges.html',
            event=self.event,
            regform=self.regform,
            settings_form=form,
            templates=badge_templates,
            registrations=registrations)
Пример #7
0
 def __init__(self, event, **kwargs):
     all_templates = set(event.designer_templates) | get_inherited_templates(event)
     badge_templates = [tpl for tpl in all_templates if tpl.type.name == 'badge']
     tickets = kwargs.pop('tickets')
     super(BadgeSettingsForm, self).__init__(**kwargs)
     self.template.choices = sorted(((unicode(tpl.id), tpl.title)
                                     for tpl in badge_templates
                                     if tpl.is_ticket == tickets),
                                    key=itemgetter(1))
Пример #8
0
 def __init__(self, event, **kwargs):
     all_templates = set(event.designer_templates) | get_inherited_templates(event)
     badge_templates = [tpl for tpl in all_templates if tpl.type.name == 'badge']
     tickets = kwargs.pop('tickets')
     super(BadgeSettingsForm, self).__init__(**kwargs)
     self.template.choices = sorted(((unicode(tpl.id), tpl.title)
                                     for tpl in badge_templates
                                     if tpl.is_ticket == tickets),
                                    key=itemgetter(1))
Пример #9
0
 def _process(self):
     templates = get_inherited_templates(self.target)
     not_deletable = get_not_deletable_templates(self.target)
     default_ticket = get_default_ticket_on_category(self.target) if isinstance(self.target, Category) else None
     default_badge = get_default_badge_on_category(self.target) if isinstance(self.target, Category) else None
     signals.event.filter_selectable_badges.send(type(self), badge_templates=templates)
     signals.event.filter_selectable_badges.send(type(self), badge_templates=not_deletable)
     return self._render_template('list.html', inherited_templates=templates, not_deletable_templates=not_deletable,
                                  default_ticket=default_ticket, default_badge=default_badge)
Пример #10
0
 def _process(self):
     if self.list_generator.static_link_used:
         return redirect(self.list_generator.get_list_url())
     reg_list_kwargs = self.list_generator.get_list_kwargs()
     badge_templates = [tpl for tpl in set(self.event.designer_templates) | get_inherited_templates(self.event)
                        if tpl.type == TemplateType.badge]
     has_tickets = any(tpl.is_ticket for tpl in badge_templates)
     has_badges = any(not tpl.is_ticket for tpl in badge_templates)
     return WPManageRegistration.render_template('management/regform_reglist.html', self.event,
                                                 has_badges=has_badges, has_tickets=has_tickets, **reg_list_kwargs)
Пример #11
0
 def _process(self):
     if self.list_generator.static_link_used:
         return redirect(self.list_generator.get_list_url())
     reg_list_kwargs = self.list_generator.get_list_kwargs()
     badge_templates = [tpl for tpl in set(self.event.designer_templates) | get_inherited_templates(self.event)
                        if tpl.type == TemplateType.badge]
     has_tickets = any(tpl.is_ticket for tpl in badge_templates)
     has_badges = any(not tpl.is_ticket for tpl in badge_templates)
     return WPManageRegistration.render_template('management/regform_reglist.html', self.event,
                                                 has_badges=has_badges, has_tickets=has_tickets, **reg_list_kwargs)
Пример #12
0
 def __init__(self, event, **kwargs):
     all_templates = set(event.designer_templates) | get_inherited_templates(event)
     badge_templates = [tpl for tpl in all_templates if tpl.type.name == 'badge']
     signals.event.filter_selectable_badges.send(type(self), badge_templates=badge_templates)
     tickets = kwargs.pop('tickets')
     super().__init__(**kwargs)
     self.template.choices = sorted(((str(tpl.id), tpl.title)
                                     for tpl in badge_templates
                                     if tpl.is_ticket == tickets),
                                    key=itemgetter(1))
Пример #13
0
 def __init__(self, *args, **kwargs):
     event = kwargs.pop('event')
     super(TicketsForm, self).__init__(*args, **kwargs)
     default_tpl = get_default_template_on_category(event.category)
     all_templates = set(event.designer_templates) | get_inherited_templates(event)
     badge_templates = [(tpl.id, tpl.title) for tpl in all_templates
                        if tpl.type == TemplateType.badge and tpl != default_tpl]
     # Show the default template first
     badge_templates.insert(0, (default_tpl.id, '{} ({})'.format(default_tpl.title, _('Default category template'))))
     self.ticket_template_id.choices = badge_templates
Пример #14
0
 def __init__(self, *args, **kwargs):
     event = kwargs.pop('event')
     super(EventSettingsForm, self).__init__(*args, **kwargs)
     default_tpl = get_default_template_on_category(event.category)
     all_templates = set(event.designer_templates) | get_inherited_templates(event)
     badge_templates = [(tpl.id, tpl.title) for tpl in all_templates
                        if tpl.type == TemplateType.badge and tpl != default_tpl]
     # Show the default template first
     badge_templates.insert(0, (default_tpl.id, '{} ({})'.format(default_tpl.title, _('Default category template'))))
     self.ticket_template_id.choices = badge_templates
Пример #15
0
 def __init__(self, event, **kwargs):
     all_templates = set(
         event.designer_templates) | get_inherited_templates(event)
     poster_templates = [
         tpl for tpl in all_templates if tpl.type.name == 'poster'
     ]
     super(PosterPrintingForm, self).__init__(**kwargs)
     self.template.choices = sorted(
         ((unicode(tpl.id), tpl.title) for tpl in poster_templates),
         key=itemgetter(1))
Пример #16
0
 def _process(self):
     templates = get_inherited_templates(self.target)
     not_deletable = get_not_deletable_templates(self.target)
     default_template = get_default_template_on_category(
         self.target) if isinstance(self.target, Category) else None
     return self._render_template(
         'list.html',
         inherited_templates=templates,
         not_deletable_templates=not_deletable,
         default_template=default_template,
     )
Пример #17
0
    def _process(self):
        all_templates = set(self.event.designer_templates) | get_inherited_templates(self.event)
        badge_templates = {tpl.id: {
            'data': tpl.data,
            'backside_tpl_id': tpl.backside_template_id,
            'orientation': 'landscape' if tpl.data['width'] > tpl.data['height'] else 'portrait',
            'format': self._get_format(tpl)
        } for tpl in all_templates if tpl.type.name == 'badge'}
        settings = event_badge_settings.get_all(self.event.id)
        form = BadgeSettingsForm(self.event, template=self.template_id, tickets=self.TICKET_BADGES, **settings)
        all_registrations = [r for r in (self.registrations or self.regform.registrations) if r.is_active]
        registrations = self._filter_registrations(all_registrations)
        if self.event.is_locked:
            del form.save_values

        if form.validate_on_submit():
            data = form.data
            if data['page_layout'] == PageLayout.foldable:
                data['top_margin'] = 0
                data['bottom_margin'] = 0
                data['left_margin'] = 0
                data['right_margin'] = 0
                data['margin_columns'] = 0
                data['margin_rows'] = 0
                data['dashed_border'] = False
            data.pop('submitted', None)
            template_id = data.pop('template')
            if data.pop('save_values', False):
                event_badge_settings.set_multi(self.event, data)
            data['registration_ids'] = [x.id for x in registrations]

            key = unicode(uuid.uuid4())
            badge_cache.set(key, data, time=1800)
            download_url = url_for('.registrations_print_badges', self.regform, template_id=template_id, uuid=key)
            return jsonify_data(flash=False, redirect=download_url, redirect_no_loading=True)
        return jsonify_template('events/registration/management/print_badges.html', event=self.event,
                                regform=self.regform, settings_form=form, templates=badge_templates,
                                registrations=registrations, all_registrations=all_registrations)
Пример #18
0
 def _process(self):
     templates = get_inherited_templates(self.target)
     not_deletable = get_not_deletable_templates(self.target)
     default_template = get_default_template_on_category(self.target) if isinstance(self.target, Category) else None
     return self._render_template('list.html', inherited_templates=templates, not_deletable_templates=not_deletable,
                                  default_template=default_template,)
Пример #19
0
 def _process(self):
     return self._render_template(
         'list.html',
         inherited_templates=get_inherited_templates(self.target))
Пример #20
0
 def __init__(self, event, **kwargs):
     all_templates = set(event.designer_templates) | get_inherited_templates(event)
     poster_templates = [tpl for tpl in all_templates if tpl.type.name == 'poster']
     super(PosterPrintingForm, self).__init__(**kwargs)
     self.template.choices = sorted(((unicode(tpl.id), tpl.title) for tpl in poster_templates), key=itemgetter(1))