feat: alphabetically order most models by default

#207
This commit is contained in:
Herculino Trotta
2025-03-09 18:55:29 -03:00
parent 187b3174d2
commit 73e8fdbf04
7 changed files with 70 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
# Generated by Django 5.1.7 on 2025-03-09 21:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('transactions', '0041_installmentplan_add_description_to_transaction_and_more'),
]
operations = [
migrations.AlterModelOptions(
name='transactioncategory',
options={'ordering': ['name', 'id'], 'verbose_name': 'Transaction Category', 'verbose_name_plural': 'Transaction Categories'},
),
migrations.AlterModelOptions(
name='transactionentity',
options={'ordering': ['name', 'id'], 'verbose_name': 'Entity', 'verbose_name_plural': 'Entities'},
),
migrations.AlterModelOptions(
name='transactiontag',
options={'ordering': ['name', 'id'], 'verbose_name': 'Transaction Tags', 'verbose_name_plural': 'Transaction Tags'},
),
]

View File

@@ -213,6 +213,7 @@ class TransactionCategory(SharedObject):
verbose_name_plural = _("Transaction Categories")
db_table = "t_categories"
unique_together = (("owner", "name"),)
ordering = ["name", "id"]
def __str__(self):
return self.name
@@ -236,6 +237,7 @@ class TransactionTag(SharedObject):
verbose_name_plural = _("Transaction Tags")
db_table = "tags"
unique_together = (("owner", "name"),)
ordering = ["name", "id"]
def __str__(self):
return self.name
@@ -259,6 +261,7 @@ class TransactionEntity(SharedObject):
verbose_name_plural = _("Entities")
db_table = "entities"
unique_together = (("owner", "name"),)
ordering = ["name", "id"]
def __str__(self):
return self.name