Add autocomplete widget and fix some errors
This commit is contained in:
+7
-1
@@ -1,13 +1,14 @@
|
||||
"""File containing member forms."""
|
||||
|
||||
from django import forms
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from members.models import Member, Payment, Request
|
||||
|
||||
import csv
|
||||
from django.utils import timezone
|
||||
import logging
|
||||
from dal import autocomplete
|
||||
|
||||
|
||||
class CSVValidationError(Exception):
|
||||
@@ -88,6 +89,11 @@ class MemberForm(forms.ModelForm):
|
||||
class PaymentForm(forms.ModelForm):
|
||||
"""Payment model form."""
|
||||
|
||||
member = forms.ModelChoiceField(
|
||||
queryset=Member.objects.all(),
|
||||
widget=autocomplete.ModelSelect2(url='member-autocomplete')
|
||||
)
|
||||
|
||||
class Meta:
|
||||
"""Meta for Payment model form."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user