class EntityFilter(django_filters.FilterSet): collab = CollaborationFilter(label=_('Modo de colaboración')) search = SearchFilter( names=['address', 'cif', 'name', 'business_name', 'contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter( fields=['name', 'start_year', 'registration_date'], field_labels={ 'name': 'Nombre', 'start_year': 'Año de inicio', 'registration_date': 'Fecha de alta' }) class Meta: model = Entity form = EntityFilterForm fields = { 'status': ['exact'], } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.form.initial['status'] = ACTIVE
class FeeChargeFilter(django_filters.FilterSet): collab = CollaborationFilter(label=_('Colaboración'), collab_field='collab__collaboration') search = AccountSearchFilter(names=['payment__concept', 'account__cif'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['payment__amount', 'payment__added'], field_labels={ 'payment__amount': 'Cuota', 'account__member_type': 'Tipo de socia', 'payment__added': 'Fecha de emisión' }) uncalculated = django_filters.BooleanFilter( field_name='payment', lookup_expr='isnull', widget=BooleanWidget(attrs={'class': 'threestate'}), label=_('Cuota sin calcular')) account__member_type = django_filters.ChoiceFilter( choices=settings.MEMBER_TYPES, label=_('Tipo de socia:')) paid = django_filters.BooleanFilter( field_name='payment__completed', widget=BooleanWidget(attrs={'class': 'threestate'}), label=_('Pagado')) class Meta: model = AccountAnnualFeeCharge form = FeeChargeFilterForm fields = {'account__member_type': ['exact']}
class SepaBatchFilter(django_filters.FilterSet): search = SearchFilter(names=['title'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['amount', 'attempt'], field_labels={'amount':'Cantidad', 'attempt':'Fecha', }) class Meta: model = SepaPaymentsBatch form = SepaBatchFilterForm fields = ['generated_by']
class SignupFilter(django_filters.FilterSet): search = SearchFilter(names=['name', 'contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['name', 'last_update'], field_labels={'name':'Nombre', 'last_update':'Última actualización'}) status = WorkflowFilter(['prov_signup'], filter_cancelled=True, label='Estado') class Meta: model = SignupProcess form = SignupFilterForm fields = { 'member_type':['exact'], }
class IntercoopAccountFilter(django_filters.FilterSet): search = SearchFilter(names=['first_name', 'last_name', 'contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['name', 'registration_date', 'expiration_date'], field_labels={'name':'Nombre', 'registration_date':'Fecha de registro', 'expiration_date':'Fecha de expiración'}) validated = django_filters.BooleanFilter(field_name='validated', widget=BooleanWidget(attrs={'class': 'threestate'})) class Meta: model = IntercoopAccount form = IntercoopAccountFilterForm fields = { 'entity':['exact']}
class ProcessFilter(django_filters.FilterSet): title = django_filters.CharFilter(field_name='title', lookup_expr='icontains', label='Buscar...') o = LabeledOrderingFilter(fields=['title', 'created']) class Meta: model = Process form = FilterForm fields = { 'member_type': ['exact'], }
class ConsumerFilter(django_filters.FilterSet): search = SearchFilter( names=['address', 'first_name', 'last_name', 'contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['last_name', 'registration_date']) class Meta: model = Consumer form = ConsumerFilterForm fields = { 'status': ['exact'], }
class CardPaymentFilter(django_filters.FilterSet): search = SearchFilter(names=['reference', 'account__contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['amount', 'attempt'], field_labels={ 'amount': 'Cantidad', 'attempt': 'Fecha' }) class Meta: model = CardPayment form = CardPaymentFilterForm fields = {'type': ['exact']}
class UserFilter(django_filters.FilterSet): search = SearchFilter( names=['username', 'first_name', 'last_name', 'email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['username', 'last_login', 'date_joined']) is_active = django_filters.BooleanFilter( field_name='is_active', widget=BooleanWidget(attrs={'class': 'threestate'})) class Meta: model = User form = UserFilterForm fields = {}
class AccountFilter(django_filters.FilterSet): # search = SearchFilter(names=['address', 'name', 'business_name', 'contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['name', 'registration_date'], field_labels={ 'name': 'Nombre', 'registration_date': 'Fecha de alta' }) class Meta: model = Account form = AccountFilterForm fields = { 'status': ['exact'], } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.form.initial['status'] = ACTIVE
class BalanceFilter(django_filters.FilterSet): search = AccountSearchFilter(names=['sponsor__username', 'account__cif'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['account', 'last_update'], field_labels={ 'account': 'Nombre', 'last_update': 'Última actualización' }) status = WorkflowFilter(['social_balance'], filter_cancelled=True, label='Estado') sponsor = SponsorFilter( label=_('Amadrinada por mí'), widget=BooleanWidget(attrs={'class': 'threestate'})) class Meta: form = BalanceFilterForm fields = {}
class PendingPaymentFilter(django_filters.FilterSet): search = AccountSearchFilter(names=['concept', 'account__cif'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(choices=(('-added', 'Fecha de emisión'), ('-amount', 'Cantidad (descendente)'), ('-timestamp', 'Fecha de pago'), ('-sepa_batches__attempt', 'Añadido a remesa'))) account = MemberTypeFilter(label='Tipo de socia') completed = django_filters.BooleanFilter( field_name='completed', widget=BooleanWidget(attrs={'class': 'threestate'})) returned = django_filters.BooleanFilter( field_name='returned', widget=BooleanWidget(attrs={'class': 'threestate'})) class Meta: model = PendingPayment form = PendingPaymentFilterForm fields = {}
class PendingPaymentFilter(django_filters.FilterSet): search = SearchFilter(names=['concept', 'account__contact_email'], lookup_expr='in', label=_('Buscar...')) o = LabeledOrderingFilter(fields=['amount', 'added', 'timestamp'], field_labels={ 'amount': 'Cantidad', 'added': 'Añadido', 'timestamp': 'Pagado' }) account = MemberTypeFilter(label='Tipo de socia') completed = django_filters.BooleanFilter( field_name='completed', widget=BooleanWidget(attrs={'class': 'threestate'})) returned = django_filters.BooleanFilter( field_name='returned', widget=BooleanWidget(attrs={'class': 'threestate'})) class Meta: model = PendingPayment form = PendingPaymentFilterForm fields = {}