This commit is contained in:
j3d1 2024-06-18 16:55:34 +02:00
parent 383c02d55b
commit 8ac7b91ba8
3 changed files with 5 additions and 5 deletions

View file

@ -1,4 +1,4 @@
# Generated by Django 4.2.7 on 2024-06-18 14:42 # Generated by Django 4.2.7 on 2024-06-18 14:54
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
@ -15,7 +15,7 @@ class Migration(migrations.Migration):
name='ShippingVoucher', name='ShippingVoucher',
fields=[ fields=[
('id', models.AutoField(primary_key=True, serialize=False)), ('id', models.AutoField(primary_key=True, serialize=False)),
('code', models.CharField(max_length=255)), ('voucher', models.CharField(max_length=255)),
('type', models.CharField(max_length=255)), ('type', models.CharField(max_length=255)),
('timestamp', models.DateTimeField(auto_now_add=True)), ('timestamp', models.DateTimeField(auto_now_add=True)),
('used_at', models.DateTimeField(null=True)), ('used_at', models.DateTimeField(null=True)),

View file

@ -141,7 +141,7 @@ class ItemRelation(models.Model):
class ShippingVoucher(models.Model): class ShippingVoucher(models.Model):
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='shipping_vouchers', null=True) issue_thread = models.ForeignKey(IssueThread, on_delete=models.CASCADE, related_name='shipping_vouchers', null=True)
code = models.CharField(max_length=255) voucher = models.CharField(max_length=255)
type = models.CharField(max_length=255) type = models.CharField(max_length=255)
timestamp = models.DateTimeField(auto_now_add=True) timestamp = models.DateTimeField(auto_now_add=True)
used_at = models.DateTimeField(null=True) used_at = models.DateTimeField(null=True)

View file

@ -127,8 +127,8 @@ class IssueSerializer(serializers.ModelSerializer):
'type': 'shipping_voucher', 'type': 'shipping_voucher',
'id': shipping_voucher.id, 'id': shipping_voucher.id,
'timestamp': shipping_voucher.used_at, 'timestamp': shipping_voucher.used_at,
'code': shipping_voucher.code, 'voucher': shipping_voucher.voucher,
'code_type': shipping_voucher.type, 'voucher_type': shipping_voucher.type,
}) })
return sorted(timeline, key=lambda x: x['timestamp']) return sorted(timeline, key=lambda x: x['timestamp'])