From deeaa0af4b10dad36ef6a49f4ea51437d0ca5ecf Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Sat, 10 May 2025 23:58:44 -0400 Subject: [PATCH] [puzzles] Fix misnamed ipdb field --- ..._rename_igdb_id_puzzle_ipdb_id_and_more.py | 29 +++++++++++++++++++ vrobbler/apps/puzzles/models.py | 18 ++++++------ 2 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 vrobbler/apps/puzzles/migrations/0003_rename_igdb_id_puzzle_ipdb_id_and_more.py diff --git a/vrobbler/apps/puzzles/migrations/0003_rename_igdb_id_puzzle_ipdb_id_and_more.py b/vrobbler/apps/puzzles/migrations/0003_rename_igdb_id_puzzle_ipdb_id_and_more.py new file mode 100644 index 0000000..7ef1beb --- /dev/null +++ b/vrobbler/apps/puzzles/migrations/0003_rename_igdb_id_puzzle_ipdb_id_and_more.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2.19 on 2025-05-11 03:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("puzzles", "0002_alter_puzzle_dimensions_in_inches"), + ] + + operations = [ + migrations.RenameField( + model_name="puzzle", + old_name="igdb_id", + new_name="ipdb_id", + ), + migrations.RemoveField( + model_name="puzzle", + name="igdb_image", + ), + migrations.AddField( + model_name="puzzle", + name="ipdb_image", + field=models.ImageField( + blank=True, null=True, upload_to="puzzles/ipdb/" + ), + ), + ] diff --git a/vrobbler/apps/puzzles/models.py b/vrobbler/apps/puzzles/models.py index 24bc30f..b4d57d4 100644 --- a/vrobbler/apps/puzzles/models.py +++ b/vrobbler/apps/puzzles/models.py @@ -31,17 +31,17 @@ class Puzzle(ScrobblableMixin): material = models.CharField(max_length=50, **BNULL) cut_style = models.CharField(max_length=100, **BNULL) pieces_count = models.IntegerField(**BNULL) - igdb_id = models.CharField(max_length=255, **BNULL) + ipdb_id = models.CharField(max_length=255, **BNULL) barcode = models.CharField(max_length=13, **BNULL) - igdb_image = models.ImageField(upload_to="puzzles/igdb/", **BNULL) - igdb_image_small = ImageSpecField( - source="igdb_image", + ipdb_image = models.ImageField(upload_to="puzzles/ipdb/", **BNULL) + ipdb_image_small = ImageSpecField( + source="ipdb_image", processors=[ResizeToFit(100, 100)], format="JPEG", options={"quality": 60}, ) - igdb_image_medium = ImageSpecField( - source="igdb_image", + ipdb_image_medium = ImageSpecField( + source="ipdb_image", processors=[ResizeToFit(300, 300)], format="JPEG", options={"quality": 75}, @@ -65,10 +65,10 @@ class Puzzle(ScrobblableMixin): return ScrobblableConstants(verb="Solving", tags="puzzle") @property - def igdb_link(self) -> str: + def ipdb_link(self) -> str: link = "" - if self.igdb_id: - link = f"https://www.ipdb.plus/IPDb/puzzle.php?id={self.igdb_id}" + if self.ipdb_id: + link = f"https://www.ipdb.plus/IPDb/puzzle.php?id={self.ipdb_id}" return link @property