mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-21 00:01:29 +02:00
feat: more changes and fixes
This commit is contained in:
@@ -38,6 +38,7 @@ class SharedObjectForm(forms.Form):
|
||||
choices=SharedObject.Visibility.choices,
|
||||
required=True,
|
||||
label=_("Visibility"),
|
||||
widget=TomSelect(clear_button=False),
|
||||
help_text=_(
|
||||
"Private: Only shown for the owner and shared users. Only editable by the owner."
|
||||
"<br/>"
|
||||
@@ -47,9 +48,6 @@ class SharedObjectForm(forms.Form):
|
||||
|
||||
class Meta:
|
||||
fields = ["visibility", "shared_with_users"]
|
||||
widgets = {
|
||||
"visibility": TomSelect(clear_button=False),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
# Get the current user to filter available sharing options
|
||||
@@ -72,7 +70,7 @@ class SharedObjectForm(forms.Form):
|
||||
self.helper.layout = Layout(
|
||||
Field("owner"),
|
||||
Field("visibility"),
|
||||
HTML("<hr>"),
|
||||
HTML('<hr class="hr my-3">'),
|
||||
Field("shared_with_users"),
|
||||
FormActions(
|
||||
NoClassSubmit("submit", _("Save"), css_class="btn btn-primary"),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.forms import widgets, SelectMultiple
|
||||
from django.forms import SelectMultiple, widgets
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
@@ -17,7 +17,7 @@ class TomSelect(widgets.Select):
|
||||
checkboxes=False,
|
||||
group_by=None,
|
||||
*args,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(attrs, *args, **kwargs)
|
||||
self.remove_button = remove_button
|
||||
|
||||
@@ -337,7 +337,7 @@ class QuickTransactionForm(forms.ModelForm):
|
||||
),
|
||||
Field("is_paid", template="transactions/widgets/paid_toggle_button.html"),
|
||||
"name",
|
||||
HTML("<hr />"),
|
||||
HTML('<hr class="hr my-3" />'),
|
||||
Row(
|
||||
Column("account"),
|
||||
Column("entities"),
|
||||
@@ -365,11 +365,8 @@ class QuickTransactionForm(forms.ModelForm):
|
||||
else:
|
||||
self.fields["amount"].widget = ArbitraryDecimalDisplayNumberInput()
|
||||
self.helper.layout.append(
|
||||
Div(
|
||||
NoClassSubmit(
|
||||
"submit", _("Add"), css_class="btn btn-outline-primary"
|
||||
),
|
||||
css_class="d-grid gap-2",
|
||||
FormActions(
|
||||
NoClassSubmit("submit", _("Add"), css_class="btn btn-primary"),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -22,11 +22,14 @@ def _format_string(prefix, amount, decimal_places, suffix):
|
||||
|
||||
|
||||
@register.simple_tag(name="currency_display")
|
||||
def currency_display(amount, prefix, suffix, decimal_places):
|
||||
def currency_display(amount, prefix, suffix, decimal_places, string=False):
|
||||
sign, prefix, amount, suffix = _format_string(
|
||||
prefix, amount, decimal_places, suffix
|
||||
)
|
||||
|
||||
if string:
|
||||
return f"{sign}{prefix}{amount}{suffix}"
|
||||
|
||||
return {
|
||||
"sign": sign,
|
||||
"prefix": prefix,
|
||||
|
||||
Reference in New Issue
Block a user