Skip to content

Commit eade0fb

Browse files
authored
fix: moneywidget accepts attrs (#1336)
1 parent 75e2405 commit eade0fb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/configuration/multi-language.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ UNFOLD = {
6262
By default, Django Unfold will automatically detect and display all available languages configured in your Django project's `LANGUAGES` setting. However, there are scenarios where you might want to customize which languages appear in the language selector or how they are presented to users. Django Unfold provides flexible configuration options that allow you to override the default language detection behavior and provide your own custom list of languages for the navigation interface.
6363

6464
This customization capability is particularly useful when you want to:
65+
6566
- Display only a subset of your configured languages in the admin interface
6667
- Present languages in a specific order that differs from your Django settings
6768
- Use custom language names or translations that better suit your admin users

src/unfold/widgets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,13 @@ class UnfoldAdminMoneyWidget(MoneyWidget):
760760
template_name = "unfold/widgets/split_money.html"
761761

762762
def __init__(self, *args, **kwargs):
763+
if "attrs" in kwargs:
764+
attrs = kwargs.pop("attrs")
765+
else:
766+
attrs = {}
767+
763768
super().__init__(
764-
amount_widget=UnfoldAdminTextInputWidget,
769+
amount_widget=UnfoldAdminTextInputWidget(attrs=attrs),
765770
currency_widget=UnfoldAdminSelectWidget(
766771
choices=CURRENCY_CHOICES,
767772
attrs={

0 commit comments

Comments
 (0)