From 780a04d13feefa96b1fcea11455d829bc8a8a9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 4 Mar 2024 16:50:37 +0100 Subject: [PATCH] Do not edit sort_name invisibly Fixes #64 --- games/models.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/games/models.py b/games/models.py index 574d461..4288f58 100644 --- a/games/models.py +++ b/games/models.py @@ -18,19 +18,6 @@ class Game(models.Model): def __str__(self): return self.name - def save(self, *args, **kwargs): - def get_sort_name(name): - articles = ["a", "an", "the"] - name_parts = name.split() - first_word = name_parts[0].lower() - if first_word in articles: - return f"{' '.join(name_parts[1:])}, {name_parts[0]}" - else: - return name - - self.sort_name = get_sort_name(self.name) - super().save(*args, **kwargs) - class Edition(models.Model): class Meta: @@ -49,19 +36,6 @@ class Edition(models.Model): def __str__(self): return self.sort_name - def save(self, *args, **kwargs): - def get_sort_name(name): - articles = ["a", "an", "the"] - name_parts = name.split() - first_word = name_parts[0].lower() - if first_word in articles: - return f"{' '.join(name_parts[1:])}, {name_parts[0]}" - else: - return name - - self.sort_name = get_sort_name(self.name) - super().save(*args, **kwargs) - class PurchaseQueryset(models.QuerySet): def refunded(self):