Skip to content

Commit abf2298

Browse files
authored
Merge pull request #175 from pneumaticapp/backend/admin/43697__error_when_deleting_user
43697 backend [ Command panel ] Error 500 when deleting an account or user
2 parents 517de2f + 8fc34b6 commit abf2298

3 files changed

Lines changed: 29 additions & 8 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 2.2 on 2026-03-17 03:38
2+
3+
from django.db import migrations, models
4+
5+
class Migration(migrations.Migration):
6+
7+
dependencies = [
8+
('accounts', '0140_alter_user_photo_max_length'),
9+
]
10+
11+
operations = [
12+
migrations.RunSQL(
13+
"UPDATE accounts_notification SET text = '' WHERE text IS NULL;",
14+
migrations.RunSQL.noop
15+
),
16+
migrations.AlterField(
17+
model_name='notification',
18+
name='text',
19+
field=models.TextField(default=''),
20+
),
21+
]

backend/src/accounts/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ class Notification(
568568
on_delete=models.CASCADE,
569569
related_name='notifications',
570570
)
571-
text = models.TextField(null=True)
571+
text = models.TextField(default='')
572572
type = models.CharField(max_length=24, choices=NotificationType.CHOICES)
573573
status = models.CharField(
574574
max_length=10,

backend/src/notifications/tests/test_tasks/test_send_urgent.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_send_urgent_notification__call_services__ok(mocker):
8282
author_id=user.id,
8383
account_id=account.id,
8484
type=NotificationType.URGENT,
85-
text=None,
85+
text='',
8686
)
8787
websocket_service_init_mock.assert_called_once_with(
8888
logo_lg=account.logo_lg,
@@ -161,7 +161,7 @@ def test_send_urgent_notification__call_services_with_group__ok(mocker):
161161
author_id=user.id,
162162
account_id=account.id,
163163
type=NotificationType.URGENT,
164-
text=None,
164+
text='',
165165
)
166166
websocket_service_init_mock.assert_called_once_with(
167167
logo_lg=account.logo_lg,
@@ -230,7 +230,7 @@ def test_send_not_urgent_notification__call_services__ok(mocker):
230230
author_id=user.id,
231231
account_id=account.id,
232232
type=NotificationType.NOT_URGENT,
233-
text=None,
233+
text='',
234234
)
235235
websocket_service_init_mock.assert_called_once_with(
236236
logo_lg=account.logo_lg,
@@ -296,7 +296,7 @@ def test_send_urgent_notification_completed_performer__skip(mocker):
296296
author_id=user.id,
297297
account_id=account.id,
298298
type=NotificationType.URGENT,
299-
text=None,
299+
text='',
300300
).exists()
301301

302302
websocket_urgent_mock.assert_not_called()
@@ -352,7 +352,7 @@ def test_send_urgent_notification_deleted_performer__skip(mocker):
352352
author_id=user.id,
353353
account_id=account.id,
354354
type=NotificationType.URGENT,
355-
text=None,
355+
text='',
356356
).exists()
357357

358358
websocket_urgent_mock.assert_not_called()
@@ -406,7 +406,7 @@ def test_send_urgent_notification_guest_performer__skip(mocker):
406406
author_id=user.id,
407407
account_id=account.id,
408408
type=NotificationType.URGENT,
409-
text=None,
409+
text='',
410410
).exists()
411411

412412
websocket_urgent_mock.assert_not_called()
@@ -459,7 +459,7 @@ def test_send_urgent_notification__another_task__skip(mocker):
459459
author_id=user.id,
460460
account_id=account.id,
461461
type=NotificationType.URGENT,
462-
text=None,
462+
text='',
463463
)
464464

465465
link = f'{settings.FRONTEND_URL}/tasks/{task_2.id}'

0 commit comments

Comments
 (0)