Enforce at least one base currency to be selected

This commit is contained in:
Oliver Walters 2019-09-07 22:42:08 +10:00
parent 654fbc3847
commit f24496c5a2

View File

@ -69,7 +69,7 @@ class Currency(models.Model):
cur.save()
# If there are no currencies set as the base currency, set this as base
if not Currency.objects.filter(base=True).exists():
if not Currency.objects.exclude(pk=self.pk).filter(base=True).exists():
self.base = True
# If this is the base currency, ensure value is set to unity