From d21e1eff702f32b1174a24491b35254684f2175f Mon Sep 17 00:00:00 2001 From: Teemu-Kostamo Date: Sat, 20 Apr 2024 18:50:18 +0300 Subject: [PATCH] Tietokannan ulkoistaminen --- ...em_avail_alter_reservation_date_returned.py | 2 +- .../migrations/0017_remove_item_item_avail.py | 17 +++++++++++++++++ .../migrations/0018_item_item_avail.py | 18 ++++++++++++++++++ .../migrations/0019_remove_item_item_avail.py | 17 +++++++++++++++++ .../migrations/0020_item_item_avail.py | 18 ++++++++++++++++++ .../lainatehdas/migrations/__init__.py | 2 ++ lainatehtailijat/lainatehdas/models.py | 2 +- 7 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 lainatehtailijat/lainatehdas/migrations/0017_remove_item_item_avail.py create mode 100644 lainatehtailijat/lainatehdas/migrations/0018_item_item_avail.py create mode 100644 lainatehtailijat/lainatehdas/migrations/0019_remove_item_item_avail.py create mode 100644 lainatehtailijat/lainatehdas/migrations/0020_item_item_avail.py diff --git a/lainatehtailijat/lainatehdas/migrations/0007_item_item_avail_alter_reservation_date_returned.py b/lainatehtailijat/lainatehdas/migrations/0007_item_item_avail_alter_reservation_date_returned.py index 36ba82b..ba58526 100644 --- a/lainatehtailijat/lainatehdas/migrations/0007_item_item_avail_alter_reservation_date_returned.py +++ b/lainatehtailijat/lainatehdas/migrations/0007_item_item_avail_alter_reservation_date_returned.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='item', name='item_avail', - field=models.CharField(choices=[('Va', 'Vapaa'), ('Vr', 'Varattu'), ('Hu', 'Huollossa'), ('Ri', 'Rikki')], default='vapaa', max_length=2), + field=models.CharField(choices=[('Va', 'Vapaa'), ('Vr', 'Varattu'), ('Hu', 'Huollossa'), ('Ri', 'Rikki')], default='Va', max_length=2), ), migrations.AlterField( model_name='reservation', diff --git a/lainatehtailijat/lainatehdas/migrations/0017_remove_item_item_avail.py b/lainatehtailijat/lainatehdas/migrations/0017_remove_item_item_avail.py new file mode 100644 index 0000000..34a5ac4 --- /dev/null +++ b/lainatehtailijat/lainatehdas/migrations/0017_remove_item_item_avail.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.3 on 2024-04-20 15:43 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('lainatehdas', '0016_remove_reservation_reservation_complete'), + ] + + operations = [ + migrations.RemoveField( + model_name='item', + name='item_avail', + ), + ] diff --git a/lainatehtailijat/lainatehdas/migrations/0018_item_item_avail.py b/lainatehtailijat/lainatehdas/migrations/0018_item_item_avail.py new file mode 100644 index 0000000..29b34ba --- /dev/null +++ b/lainatehtailijat/lainatehdas/migrations/0018_item_item_avail.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.3 on 2024-04-20 15:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('lainatehdas', '0017_remove_item_item_avail'), + ] + + operations = [ + migrations.AddField( + model_name='item', + name='item_avail', + field=models.CharField(choices=[('Va', 'Vapaa'), ('Vr', 'Varattu'), ('Hu', 'Huollossa'), ('Ri', 'Rikki')], default='Va', max_length=2), + ), + ] diff --git a/lainatehtailijat/lainatehdas/migrations/0019_remove_item_item_avail.py b/lainatehtailijat/lainatehdas/migrations/0019_remove_item_item_avail.py new file mode 100644 index 0000000..0a43668 --- /dev/null +++ b/lainatehtailijat/lainatehdas/migrations/0019_remove_item_item_avail.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0.3 on 2024-04-20 15:44 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('lainatehdas', '0018_item_item_avail'), + ] + + operations = [ + migrations.RemoveField( + model_name='item', + name='item_avail', + ), + ] diff --git a/lainatehtailijat/lainatehdas/migrations/0020_item_item_avail.py b/lainatehtailijat/lainatehdas/migrations/0020_item_item_avail.py new file mode 100644 index 0000000..ab0600a --- /dev/null +++ b/lainatehtailijat/lainatehdas/migrations/0020_item_item_avail.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.3 on 2024-04-20 15:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('lainatehdas', '0019_remove_item_item_avail'), + ] + + operations = [ + migrations.AddField( + model_name='item', + name='item_avail', + field=models.CharField(choices=[('Va', 'Vapaa'), ('Vr', 'Varattu'), ('Hu', 'Huollossa'), ('Ri', 'Rikki')], default='Va', max_length=2), + ), + ] diff --git a/lainatehtailijat/lainatehdas/migrations/__init__.py b/lainatehtailijat/lainatehdas/migrations/__init__.py index e69de29..9dc3cf7 100644 --- a/lainatehtailijat/lainatehdas/migrations/__init__.py +++ b/lainatehtailijat/lainatehdas/migrations/__init__.py @@ -0,0 +1,2 @@ +import pymysql +pymysql.install_as_MySQLdb \ No newline at end of file diff --git a/lainatehtailijat/lainatehdas/models.py b/lainatehtailijat/lainatehdas/models.py index 664fcb4..b23162c 100644 --- a/lainatehtailijat/lainatehdas/models.py +++ b/lainatehtailijat/lainatehdas/models.py @@ -23,7 +23,7 @@ class Item(models.Model): item_name = models.CharField(max_length= 200, verbose_name="Name") item_desc = models.CharField(max_length= 500, verbose_name="Description") item_type = models.CharField(max_length=4, choices=item_choices, verbose_name="Type") - item_avail = models.CharField(max_length=2, choices=item_avail_choices) + item_avail = models.CharField(max_length=2, choices=item_avail_choices, default="Va") item_img = models.ImageField(upload_to='media/', default='media/placeholder.jpg') def __str__(self) -> str: return self.item_name