From 05b59e41b50f23835b533b30a43de49a2bf48eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sun, 10 Nov 2024 23:39:43 +0100 Subject: [PATCH] Add model change --- ...rency_purchase_converted_price_and_more.py | 36 +++++++++++++++++++ games/models.py | 4 +-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 games/migrations/0041_purchase_converted_currency_purchase_converted_price_and_more.py diff --git a/games/migrations/0041_purchase_converted_currency_purchase_converted_price_and_more.py b/games/migrations/0041_purchase_converted_currency_purchase_converted_price_and_more.py new file mode 100644 index 0000000..22f1c23 --- /dev/null +++ b/games/migrations/0041_purchase_converted_currency_purchase_converted_price_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 5.1.3 on 2024-11-10 15:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('games', '0040_migrate_device_types'), + ] + + operations = [ + migrations.AddField( + model_name='purchase', + name='converted_currency', + field=models.CharField(max_length=3, null=True), + ), + migrations.AddField( + model_name='purchase', + name='converted_price', + field=models.FloatField(null=True), + ), + migrations.CreateModel( + name='ExchangeRate', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('currency_from', models.CharField(max_length=255)), + ('currency_to', models.CharField(max_length=255)), + ('year', models.PositiveIntegerField()), + ('rate', models.FloatField()), + ], + options={ + 'unique_together': {('currency_from', 'currency_to', 'year')}, + }, + ), + ] diff --git a/games/models.py b/games/models.py index 5793d50..18cab6f 100644 --- a/games/models.py +++ b/games/models.py @@ -124,8 +124,8 @@ class Purchase(models.Model): infinite = models.BooleanField(default=False) price = models.FloatField(default=0) price_currency = models.CharField(max_length=3, default="USD") - converted_price = models.FloatField() - converted_currency = models.CharField(max_length=3) + converted_price = models.FloatField(null=True) + converted_currency = models.CharField(max_length=3, null=True) ownership_type = models.CharField( max_length=2, choices=OWNERSHIP_TYPES, default=DIGITAL )