parent
fd04e9fa77
commit
780a04d13f
|
@ -18,19 +18,6 @@ class Game(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
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 Edition(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -49,19 +36,6 @@ class Edition(models.Model):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.sort_name
|
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):
|
class PurchaseQueryset(models.QuerySet):
|
||||||
def refunded(self):
|
def refunded(self):
|
||||||
|
|
Loading…
Reference in New Issue