3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-22 19:33:11 +00:00

Fix is_usable_in_cotisation

Close #15
This commit is contained in:
Yoann Pétri 2018-12-16 11:20:02 +01:00
parent 48ab574be2
commit 98a30f4215
2 changed files with 6 additions and 1 deletions

View file

@ -11,7 +11,7 @@ from coopeV3.widgets import SearchField
class ReloadForm(forms.ModelForm): class ReloadForm(forms.ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ReloadForm, self).__init__(*args, **kwargs) super(ReloadForm, self).__init__(*args, **kwargs)
self.fields['PaymentMethod'].queryset = PaymentMethod.objects.filter(is_usable_in_reload=True) self.fields['PaymentMethod'].queryset = PaymentMethod.objects.filter(is_usable_in_reload=True).filter(is_active=True)
class Meta: class Meta:
model = Reload model = Reload

View file

@ -2,6 +2,7 @@ from django import forms
from django.contrib.auth.models import User, Group from django.contrib.auth.models import User, Group
from dal import autocomplete from dal import autocomplete
from .models import School, CotisationHistory, WhiteListHistory from .models import School, CotisationHistory, WhiteListHistory
from preferences.models import PaymentMethod
class LoginForm(forms.Form): class LoginForm(forms.Form):
""" """
@ -84,6 +85,10 @@ class addCotisationHistoryForm(forms.ModelForm):
""" """
Form to add a cotisation to user Form to add a cotisation to user
""" """
def __init__(self, *args, **kwargs):
super(addCotisationHistoryForm, self).__init__(*args, **kwargs)
self.fields['paymentMethod'].queryset = PaymentMethod.objects.filter(is_usable_in_cotisation=True).filter(is_active=True)
class Meta: class Meta:
model = CotisationHistory model = CotisationHistory
fields = ("cotisation", "paymentMethod") fields = ("cotisation", "paymentMethod")