feat: add Currency Converter

This commit is contained in:
Herculino Trotta
2024-12-21 16:30:04 -03:00
parent 8d7af0b5b6
commit d570be9dd6
7 changed files with 186 additions and 1 deletions

View 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",
)