From 2fe939460be47e9a3c2437ea48b616308b96ba80 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sat, 20 Feb 2021 07:21:58 +0100 Subject: [PATCH] Define string representations for wishlist models --- wishlist/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wishlist/models.py b/wishlist/models.py index 9d3bec3..2aabd71 100644 --- a/wishlist/models.py +++ b/wishlist/models.py @@ -12,6 +12,8 @@ class WishList(models.Model): hidden = models.BooleanField(default=True, help_text="Whether to hide on the users' list of their wishlists.") hide_granted = models.BooleanField(default=False, help_text="Whether to hide already fulfilled wishes.") + def __str__(self): return self.name + class WishedItem(models.Model): # Meta class? @@ -21,6 +23,8 @@ class WishedItem(models.Model): description = models.TextField(blank=True, help_text="Detailed description of the item, for example its specification.") wishlists = models.ManyToManyField(WishList, related_name='wishes', help_text="Wishlists that this wish should be part of.") + def __str__(self): return self.name + # FIXME: create more sensible name... class DreamComeTrue(models.Model): @@ -28,3 +32,4 @@ class DreamComeTrue(models.Model): when = models.DateTimeField(auto_now_add=True, help_text="When the dream came true") note = models.TextField(blank=True, help_text="Optional note, e.g. tracking number. Private, shown only to owner.") + def __str__(self): return f"Dream of {self.item} came true on {self.when}"