Skip to content

Commit 43be2f4

Browse files
authored
Bump: django from 4.2.25 to 5.2.7 (#28)
* Migration WalletTransaction.Type choices from text to integer * Added postgresql connections pool * Bump django, updated setuptools and deleted typing_extensions. - typing_extensions, not required by installed dependencies.
1 parent e3b6109 commit 43be2f4

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test: build
2828
${DOCKER_COMPOSE_RUN_WEB} web python manage.py test --failfast api
2929

3030
deprecations: build migrate
31-
${DOCKER_COMPOSE_RUN_WEB} web python -Wa manage.py test --failfast api
31+
${DOCKER_COMPOSE_RUN_WEB} web python -Wa manage.py test
3232

3333
shell:
3434
${DOCKER_COMPOSE_RUN_WEB} web ash

environment/requirements/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
asgiref==3.10.0
22
backcall==0.2.0
33
decorator==5.2.1
4-
Django==4.2.25
4+
Django==5.2.7
55
django-extensions==4.1
66
djangorestframework==3.16.1
77
Faker==37.8.0
@@ -19,8 +19,8 @@ ptyprocess==0.7.0
1919
pycodestyle==2.8.0
2020
pyflakes==2.4.0
2121
Pygments==2.19.2
22+
setuptools==80.9.0
2223
sqlparse==0.5.3
2324
traitlets==5.14.3
24-
typing_extensions==4.15.0
2525
tzdata==2025.2
2626
wcwidth==0.2.14
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.7 on 2025-10-06 17:09
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='clientwallettransaction',
15+
name='transaction_type',
16+
field=models.IntegerField(choices=[(0, 'Error'), (1, 'Testing'), (2, 'Deposit'), (3, 'Withdraw')], default=1, help_text='Add or substract money'),
17+
),
18+
]

src/api/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class WalletTransaction(models.Model):
6868
6969
amount and client_wallet_account are the only required fields.
7070
"""
71-
class Type(models.TextChoices):
71+
class Type(models.IntegerChoices):
7272
ERROR = 0
7373
TESTING = 1
7474
DEPOSIT = 2
@@ -79,7 +79,7 @@ class Type(models.TextChoices):
7979
amount = models.DecimalField(max_digits=7, decimal_places=2)
8080
done = models.BooleanField(default=True, help_text="It check if the transaction was completed")
8181
transaction_type = models.IntegerField(
82-
choices=Type.choices, default=Type.TESTING.value, help_text="Add or substract money"
82+
choices=Type, default=Type.TESTING.value, help_text="Add or substract money"
8383
)
8484
error_msg = models.CharField(max_length=250, null=True, blank=True, unique=False,
8585
help_text="Ex. Transaction error: negative balance")

src/api/tests.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,11 @@ def test_create_regular_user_transactions_as_regular_user(self):
670670
"client_wallet_account": self.regular_user_wallet.id
671671
}
672672
if payload.get('amount', 0) > 0:
673-
transaction_type = str(ClientWalletTransaction.Type.DEPOSIT.value)
673+
transaction_type = ClientWalletTransaction.Type.DEPOSIT.value
674674
elif payload.get('amount', 0) < 0:
675-
transaction_type = str(ClientWalletTransaction.Type.WITHDRAW.value)
675+
transaction_type = ClientWalletTransaction.Type.WITHDRAW.value
676676
else:
677-
transaction_type = str(ClientWalletTransaction.Type.TESTING.value)
677+
transaction_type = ClientWalletTransaction.Type.TESTING.value
678678
response_data = {
679679
**payload,
680680
"amount": str(payload.get('amount')),
@@ -734,11 +734,11 @@ def test_create_regular_user_transactions_as_staff_user(self):
734734
"client_wallet_account": self.regular_user_wallet.id
735735
}
736736
if payload.get('amount', 0) > 0:
737-
transaction_type = str(ClientWalletTransaction.Type.DEPOSIT.value)
737+
transaction_type = ClientWalletTransaction.Type.DEPOSIT.value
738738
elif payload.get('amount', 0) < 0:
739-
transaction_type = str(ClientWalletTransaction.Type.WITHDRAW.value)
739+
transaction_type = ClientWalletTransaction.Type.WITHDRAW.value
740740
else:
741-
transaction_type = str(ClientWalletTransaction.Type.TESTING.value)
741+
transaction_type = ClientWalletTransaction.Type.TESTING.value
742742
response_data = {
743743
**payload,
744744
"amount": str(payload.get('amount')),
@@ -778,11 +778,11 @@ def test_create_staff_user_transactions_as_staff_user(self):
778778
"client_wallet_account": user_wallet.id
779779
}
780780
if payload.get('amount', 0) > 0:
781-
transaction_type = str(ClientWalletTransaction.Type.DEPOSIT.value)
781+
transaction_type = ClientWalletTransaction.Type.DEPOSIT.value
782782
elif payload.get('amount', 0) < 0:
783-
transaction_type = str(ClientWalletTransaction.Type.WITHDRAW.value)
783+
transaction_type = ClientWalletTransaction.Type.WITHDRAW.value
784784
else:
785-
transaction_type = str(ClientWalletTransaction.Type.TESTING.value)
785+
transaction_type = ClientWalletTransaction.Type.TESTING.value
786786
response_data = {
787787
**payload,
788788
"amount": str(payload.get('amount')),

src/commons/tests.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
Author: Adrian G
77
Created: 2019/03/16
8-
Contact: mroot5@outlook.es
98
Notes:
109
test --keepdb
1110
https://docs.djangoproject.com/en/dev/ref/django-admin/#cmdoption-test-keepdb
@@ -18,10 +17,6 @@
1817
1918
https://docs.djangoproject.com/en/dev/topics/testing/tools/#exceptions
2019
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises
21-
22-
Terminal colors:
23-
* Yellow: \e[33mText\e[0m
24-
* Red: \e[32mText\e[0m
2520
"""
2621

2722

src/django_atomic_transactions/settings.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@
5858
'USER': os.environ.get('DJANGO_DATABASE_USER'),
5959
'PASSWORD': os.environ.get('DJANGO_DATABASE_PASSWORD'),
6060
'HOST': os.environ.get('DJANGO_DATABASE_HOST'),
61-
'PORT': os.environ.get('DJANGO_DATABASE_PORT', 5432)
62-
}
61+
'PORT': os.environ.get('DJANGO_DATABASE_PORT', 5432),
62+
'OPTIONS': {
63+
'pool': {
64+
'min_size': 1,
65+
'max_size': 4,
66+
'timeout': 10,
67+
}
68+
}
69+
},
6370
}
6471

6572
AUTH_PASSWORD_VALIDATORS = [

0 commit comments

Comments
 (0)