Add AccountSelect widget and update account field in forms
- Introduced AccountSelect widget for improved account selection in forms. - Updated AccountForm, StatementForm, and TransactionFiltersForm to use AccountSelect. - Modified account model options to include 'archived' in ordering. - Added new migration for account model options change.
This commit is contained in:
parent
ccbf433ec0
commit
a238401f13
7 changed files with 73 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
from django.forms.widgets import Select
|
||||
from main.forms import IconInput, NummiForm
|
||||
|
||||
from .models import Account
|
||||
|
@ -15,3 +16,7 @@ class AccountForm(NummiForm):
|
|||
widgets = {
|
||||
"icon": IconInput(),
|
||||
}
|
||||
|
||||
|
||||
class AccountSelect(Select):
|
||||
template_name = "account/forms/widgets/account.html"
|
||||
|
|
20
nummi/account/migrations/0004_alter_account_options.py
Normal file
20
nummi/account/migrations/0004_alter_account_options.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 4.2.7 on 2025-01-04 17:44
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("account", "0003_account_archived"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="account",
|
||||
options={
|
||||
"ordering": ["-default", "archived", "name"],
|
||||
"verbose_name": "Account",
|
||||
"verbose_name_plural": "Accounts",
|
||||
},
|
||||
),
|
||||
]
|
|
@ -41,7 +41,7 @@ class Account(UserModel):
|
|||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-default", "name"]
|
||||
ordering = ["-default", "archived", "name"]
|
||||
verbose_name = _("Account")
|
||||
verbose_name_plural = _("Accounts")
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{% load main_extras %}
|
||||
<span class="ico-input account-select">
|
||||
{{ "bank"|remix }}
|
||||
{% include "django/forms/widgets/select.html" %}
|
||||
</span>
|
Loading…
Add table
Add a link
Reference in a new issue