class ChoiceForm(forms.Form): choice_field = forms.ModelMultipleChoiceField( queryset=Choice.objects.all(), widget=TableSelectMultiple(item_attrs=[ ('choice_type__get_name', 'Type') ], ), )
class SelectUsersPayForm(SubmitMixin, forms.Form): paing_for = forms.ModelMultipleChoiceField( UserAttendance.objects.none(), label=_("Vyberte soutěžící, za které zaplatíte fakturou"), required=False, help_text=string_concat(_("Ceny jsou uváděny bez DPH"), ), widget=TableSelectMultiple( item_attrs=[ ('company_admission_fee_intcomma', _("Částka")), ('userprofile__user__first_name', _("Jméno")), ('userprofile__user__last_name', _("Příjmení")), ('userprofile__nickname', _("Přezdívka")), ('userprofile__user__email', _("E-mail")), ('team__subsidiary__city', _("Město")), ], enable_shift_select=True, enable_datatables=True, bootstrap_style=True, ), ) def __init__(self, request=None, *args, **kwargs): initial = kwargs.pop('initial', None) company_admin = initial['company_admin'] queryset = UserAttendance.objects.filter( team__subsidiary__company=company_admin.administrated_company, campaign=company_admin.campaign, userprofile__user__is_active=True, representative_payment__pay_type='fc', ).exclude(payment_status='done', ).select_related( 'userprofile__user', 'campaign', 'team__subsidiary__city', 't_shirt_size', 'representative_payment', ).order_by( 'team__subsidiary__city', 'userprofile__user__last_name', 'userprofile__user__first_name', ) ret_val = super().__init__(*args, **kwargs) self.fields['paing_for'].queryset = queryset self.helper.form_class = "dirty-check" self.helper.layout = Layout( HTML("<div class='text-info'>"), HTML(_("Tip: Použijte shift pro výběr rozsahu položek.")), HTML("</div><br/>"), 'paing_for', ) self.fields['paing_for'].widget.datatable_options = { 'language': { 'url': static("/js/datatables-plugins/i18n/%s.json" % request.LANGUAGE_CODE) }, } return ret_val
class ChoiceForm(forms.Form): choice_field = forms.ModelMultipleChoiceField( queryset=Choice.objects.all(), widget=TableSelectMultiple( item_attrs=['name'], enable_datatables=True, ), )
class ChoiceForm(forms.Form): choice_field = forms.ModelMultipleChoiceField( queryset=Choice.objects.all(), widget=TableSelectMultiple(item_attrs=[ 'name', 'description', ], ), )
class ChoiceForm(forms.Form): choice_field = forms.ModelMultipleChoiceField( queryset=Choice.objects.all(), widget=TableSelectMultiple( item_attrs=['name'], enable_datatables=True, datatable_options={ 'language': { 'url': 'foo.js' }, }, ), )
class SelectUsersPayForm(SubmitMixin, forms.Form): submit_text = _("Schválit") paying_for = forms.ModelMultipleChoiceField( UserAttendance.objects.none(), label=_( "Vyberte týmové hráče, za které Vaše společnost zaplatí startovné." ), required=False, help_text=_("Ceny jsou uváděny bez DPH"), widget=TableSelectMultiple( item_attrs=[ ("company_admission_fee_intcomma", _("Částka")), ("userprofile__user__first_name", _("Jméno")), ("userprofile__user__last_name", _("Příjmení")), ("userprofile__nickname", _("Přezdívka")), ("userprofile__user__email", _("E-mail")), ("team__subsidiary__city", _("Město")), ("created", _("Čas registrace")), ], enable_shift_select=True, enable_datatables=True, bootstrap_style=True, ), ) def __init__(self, request=None, *args, **kwargs): initial = kwargs.pop("initial", None) company_admin = initial["company_admin"] queryset = (UserAttendance.objects.filter( team__subsidiary__company=company_admin.administrated_company, campaign=company_admin.campaign, userprofile__user__is_active=True, representative_payment__pay_type="fc", ).exclude(payment_status="done", ).select_related( "userprofile__user", "campaign", "team__subsidiary__city", "t_shirt_size", "representative_payment", ).order_by( "team__subsidiary__city", "userprofile__user__last_name", "userprofile__user__first_name", )) ret_val = super().__init__(*args, **kwargs) self.fields["paying_for"].queryset = queryset self.helper.form_class = "dirty-check" self.helper.form_id = "fa-select-users-pay-form" self.helper.layout = Layout( HTML("<div class='text-info'>"), HTML(_("Tip: Použijte shift pro výběr rozsahu položek.")), HTML("</div><br/>"), "paying_for", ) self.fields["paying_for"].widget.datatable_options = { "language": { "url": static("/js/datatables-plugins/i18n/%s.json" % request.LANGUAGE_CODE) }, } return ret_val