[puzzles] Fix misnamed ipdb field

This commit is contained in:
2025-05-10 23:58:44 -04:00
parent dd71bdd38c
commit deeaa0af4b
2 changed files with 38 additions and 9 deletions

View File

@ -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/"
),
),
]

View File

@ -31,17 +31,17 @@ class Puzzle(ScrobblableMixin):
material = models.CharField(max_length=50, **BNULL) material = models.CharField(max_length=50, **BNULL)
cut_style = models.CharField(max_length=100, **BNULL) cut_style = models.CharField(max_length=100, **BNULL)
pieces_count = models.IntegerField(**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) barcode = models.CharField(max_length=13, **BNULL)
igdb_image = models.ImageField(upload_to="puzzles/igdb/", **BNULL) ipdb_image = models.ImageField(upload_to="puzzles/ipdb/", **BNULL)
igdb_image_small = ImageSpecField( ipdb_image_small = ImageSpecField(
source="igdb_image", source="ipdb_image",
processors=[ResizeToFit(100, 100)], processors=[ResizeToFit(100, 100)],
format="JPEG", format="JPEG",
options={"quality": 60}, options={"quality": 60},
) )
igdb_image_medium = ImageSpecField( ipdb_image_medium = ImageSpecField(
source="igdb_image", source="ipdb_image",
processors=[ResizeToFit(300, 300)], processors=[ResizeToFit(300, 300)],
format="JPEG", format="JPEG",
options={"quality": 75}, options={"quality": 75},
@ -65,10 +65,10 @@ class Puzzle(ScrobblableMixin):
return ScrobblableConstants(verb="Solving", tags="puzzle") return ScrobblableConstants(verb="Solving", tags="puzzle")
@property @property
def igdb_link(self) -> str: def ipdb_link(self) -> str:
link = "" link = ""
if self.igdb_id: if self.ipdb_id:
link = f"https://www.ipdb.plus/IPDb/puzzle.php?id={self.igdb_id}" link = f"https://www.ipdb.plus/IPDb/puzzle.php?id={self.ipdb_id}"
return link return link
@property @property