Sith/accounting/widgets/select.py

40 lines
1.1 KiB
Python
Raw Normal View History

from pydantic import TypeAdapter
2024-10-21 11:26:11 +00:00
from accounting.models import ClubAccount, Company
from accounting.schemas import ClubAccountSchema, CompanySchema
from core.views.widgets.select import AutoCompleteSelect, AutoCompleteSelectMultiple
_js = ["bundled/accounting/components/ajax-select-index.ts"]
2024-10-21 11:26:11 +00:00
class AutoCompleteSelectClubAccount(AutoCompleteSelect):
2024-10-21 11:26:11 +00:00
component_name = "club-account-ajax-select"
model = ClubAccount
adapter = TypeAdapter(list[ClubAccountSchema])
2024-10-21 11:26:11 +00:00
js = _js
2024-10-21 11:26:11 +00:00
class AutoCompleteSelectMultipleClubAccount(AutoCompleteSelectMultiple):
2024-10-21 11:26:11 +00:00
component_name = "club-account-ajax-select"
model = ClubAccount
adapter = TypeAdapter(list[ClubAccountSchema])
2024-10-21 11:26:11 +00:00
js = _js
2024-10-21 11:26:11 +00:00
class AutoCompleteSelectCompany(AutoCompleteSelect):
2024-10-21 11:26:11 +00:00
component_name = "company-ajax-select"
model = Company
adapter = TypeAdapter(list[CompanySchema])
2024-10-21 11:26:11 +00:00
js = _js
2024-10-21 11:26:11 +00:00
class AutoCompleteSelectMultipleCompany(AutoCompleteSelectMultiple):
2024-10-21 11:26:11 +00:00
component_name = "company-ajax-select"
model = Company
adapter = TypeAdapter(list[CompanySchema])
2024-10-21 11:26:11 +00:00
js = _js