mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-19 23:31:27 +02:00
feat: add Currency Converter
This commit is contained in:
29
app/apps/mini_tools/forms.py
Normal file
29
app/apps/mini_tools/forms.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Layout, Row, Column
|
||||
from django import forms
|
||||
from apps.currencies.models import Currency
|
||||
from apps.common.widgets.tom_select import TomSelect
|
||||
|
||||
|
||||
class CurrencyConverterForm(forms.Form):
|
||||
from_currency = forms.ModelChoiceField(
|
||||
queryset=Currency.objects.all(),
|
||||
label="",
|
||||
widget=TomSelect(clear_button=False),
|
||||
)
|
||||
|
||||
to_currency = forms.ModelChoiceField(
|
||||
queryset=Currency.objects.all(),
|
||||
label="",
|
||||
widget=TomSelect(clear_button=False),
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CurrencyConverterForm, self).__init__(*args, **kwargs)
|
||||
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_tag = False
|
||||
self.helper.layout = Layout(
|
||||
"from_currency",
|
||||
"to_currency",
|
||||
)
|
||||
Reference in New Issue
Block a user