mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-11 15:22:55 +02:00
fix(currencies): don't error out if from_currency or to_currency isn't set
This commit is contained in:
@@ -72,7 +72,9 @@ class ExchangeRate(models.Model):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
if self.from_currency == self.to_currency:
|
# Check if the attributes exist before comparing them
|
||||||
raise ValidationError(
|
if hasattr(self, "from_currency") and hasattr(self, "to_currency"):
|
||||||
{"to_currency": _("From and To currencies cannot be the same.")}
|
if self.from_currency == self.to_currency:
|
||||||
)
|
raise ValidationError(
|
||||||
|
{"to_currency": _("From and To currencies cannot be the same.")}
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user