From 4f93a3654652577a7f8f91d5b20a613d31c01083 Mon Sep 17 00:00:00 2001 From: jedi Date: Sat, 23 Nov 2024 01:35:05 +0100 Subject: [PATCH] stash --- core/core/settings.py | 3 +- ...ontainer_alter_item_event_itemplacement.py | 32 ------------------- ..._alter_itemplacement_container_and_more.py | 29 ----------------- core/inventory/migrations/0009_comment.py | 23 ------------- core/mail/protocol.py | 2 +- core/tickets/api_v2.py | 3 +- .../0012_alter_itemrelation_item.py | 20 ------------ ...ove_issuethread_related_items_and_more.py} | 6 ++-- 8 files changed, 8 insertions(+), 110 deletions(-) delete mode 100644 core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py delete mode 100644 core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py delete mode 100644 core/inventory/migrations/0009_comment.py delete mode 100644 core/tickets/migrations/0012_alter_itemrelation_item.py rename core/tickets/migrations/{0013_remove_issuethread_related_items_and_more.py => 0012_remove_issuethread_related_items_and_more.py} (80%) diff --git a/core/core/settings.py b/core/core/settings.py index 94f15eb..cfa395c 100644 --- a/core/core/settings.py +++ b/core/core/settings.py @@ -56,6 +56,7 @@ TELEGRAM_GROUP_CHAT_ID = os.getenv('TELEGRAM_GROUP_CHAT_ID', '-1234567890') # Application definition INSTALLED_APPS = [ + *(['daphne'] if 'runserver' in sys.argv else []), 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -129,7 +130,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = 'core.wsgi.application' +ASGI_APPLICATION = 'core.asgi.application' # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases diff --git a/core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py b/core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py deleted file mode 100644 index 7ea5d8e..0000000 --- a/core/inventory/migrations/0007_remove_item_container_alter_item_event_itemplacement.py +++ /dev/null @@ -1,32 +0,0 @@ -# Generated by Django 4.2.7 on 2024-11-20 01:48 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('inventory', '0006_alter_event_table'), - ] - - operations = [ - migrations.RemoveField( - model_name='item', - name='container', - ), - migrations.AlterField( - model_name='item', - name='event', - field=models.ForeignKey(db_column='eid', on_delete=django.db.models.deletion.CASCADE, to='inventory.event'), - ), - migrations.CreateModel( - name='ItemPlacement', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('timestamp', models.DateTimeField(auto_now_add=True)), - ('container', models.ForeignKey(db_column='cid', on_delete=django.db.models.deletion.CASCADE, related_name='item_history', to='inventory.container')), - ('item', models.ForeignKey(db_column='iid', on_delete=django.db.models.deletion.CASCADE, related_name='container_history', to='inventory.item')), - ], - ), - ] diff --git a/core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py b/core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py deleted file mode 100644 index 2fae077..0000000 --- a/core/inventory/migrations/0008_alter_item_event_alter_itemplacement_container_and_more.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 4.2.7 on 2024-11-20 01:52 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('inventory', '0007_remove_item_container_alter_item_event_itemplacement'), - ] - - operations = [ - migrations.AlterField( - model_name='item', - name='event', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.event'), - ), - migrations.AlterField( - model_name='itemplacement', - name='container', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='item_history', to='inventory.container'), - ), - migrations.AlterField( - model_name='itemplacement', - name='item', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='container_history', to='inventory.item'), - ), - ] diff --git a/core/inventory/migrations/0009_comment.py b/core/inventory/migrations/0009_comment.py deleted file mode 100644 index 0a5f720..0000000 --- a/core/inventory/migrations/0009_comment.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.2.7 on 2024-11-22 22:02 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('inventory', '0008_alter_item_event_alter_itemplacement_container_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='Comment', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('comment', models.TextField()), - ('timestamp', models.DateTimeField(auto_now_add=True)), - ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='inventory.item')), - ], - ), - ] diff --git a/core/mail/protocol.py b/core/mail/protocol.py index 6b4dc6d..02d87ab 100644 --- a/core/mail/protocol.py +++ b/core/mail/protocol.py @@ -71,7 +71,7 @@ def make_reply(reply_email, references=None, event=None): reply["From"] = reply_email.sender reply["To"] = reply_email.recipient reply["Subject"] = reply_email.subject - reply["Reply-To"] = f"{event}@{MAIL_DOMAIN}" + reply["Reply-To"] = f"{event.lower()}@{MAIL_DOMAIN}" if reply_email.in_reply_to: reply["In-Reply-To"] = reply_email.in_reply_to if reply_email.reference: diff --git a/core/tickets/api_v2.py b/core/tickets/api_v2.py index c5e01e4..9e601ba 100644 --- a/core/tickets/api_v2.py +++ b/core/tickets/api_v2.py @@ -21,7 +21,8 @@ from tickets.shared_serializers import RelationSerializer class IssueViewSet(viewsets.ModelViewSet): serializer_class = IssueSerializer - queryset = IssueThread.objects.all().prefetch_related('state_changes', 'comments', 'emails', 'emails__attachments', 'assignments', 'item_relation_changes', 'shipping_vouchers') + queryset = IssueThread.objects.all().prefetch_related('state_changes', 'comments', 'emails', 'emails__attachments', + 'assignments', 'item_relation_changes', 'shipping_vouchers') class RelationViewSet(viewsets.ModelViewSet): diff --git a/core/tickets/migrations/0012_alter_itemrelation_item.py b/core/tickets/migrations/0012_alter_itemrelation_item.py deleted file mode 100644 index a8ea2a5..0000000 --- a/core/tickets/migrations/0012_alter_itemrelation_item.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.2.7 on 2024-11-20 01:48 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('inventory', '0007_remove_item_container_alter_item_event_itemplacement'), - ('tickets', '0011_train_old_spam'), - ] - - operations = [ - migrations.AlterField( - model_name='itemrelation', - name='item', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='issue_relations', to='inventory.item'), - ), - ] diff --git a/core/tickets/migrations/0013_remove_issuethread_related_items_and_more.py b/core/tickets/migrations/0012_remove_issuethread_related_items_and_more.py similarity index 80% rename from core/tickets/migrations/0013_remove_issuethread_related_items_and_more.py rename to core/tickets/migrations/0012_remove_issuethread_related_items_and_more.py index 29da48f..d8a24c7 100644 --- a/core/tickets/migrations/0013_remove_issuethread_related_items_and_more.py +++ b/core/tickets/migrations/0012_remove_issuethread_related_items_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.7 on 2024-11-20 23:34 +# Generated by Django 4.2.7 on 2024-11-20 23:58 from django.db import migrations, models import django.db.models.deletion @@ -7,8 +7,8 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('inventory', '0008_alter_item_event_alter_itemplacement_container_and_more'), - ('tickets', '0012_alter_itemrelation_item'), + ('inventory', '0006_alter_event_table'), + ('tickets', '0011_train_old_spam'), ] operations = [