nk20/apps/note/forms.py

39 lines
1.6 KiB
Python
Raw Normal View History

2019-08-11 17:55:04 +00:00
#!/usr/bin/env python
2020-02-08 19:23:17 +00:00
from dal import autocomplete
2019-08-11 17:55:04 +00:00
from django import forms
2020-02-08 19:23:17 +00:00
from .models import Transaction, TransactionTemplate
2019-08-11 17:55:04 +00:00
class TransactionTemplateForm(forms.ModelForm):
class Meta:
model = TransactionTemplate
fields ='__all__'
2020-02-08 19:23:17 +00:00
widgets = {
'destination': autocomplete.ModelSelect2(url='note:note_autocomplete',
attrs={
'data-placeholder': 'Note ...',
'data-minimum-input-length': 1,
}),
}
class TransactionForm(forms.ModelForm):
class Meta:
model = Transaction
fields = ('destination', 'reason', 'amount',)
widgets = {
2020-02-08 19:39:37 +00:00
'source': autocomplete.ModelSelect2(url='note:note_autocomplete',
attrs={
'data-placeholder': 'Note ...',
'data-minimum-input-length': 1,
}),
2020-02-08 19:23:17 +00:00
'destination': autocomplete.ModelSelect2(url='note:note_autocomplete',
attrs={
'data-placeholder': 'Note ...',
'data-minimum-input-length': 1,
}),
}