refactor: Update validation error message in Transportation model clean method

This commit is contained in:
Sean Morley
2024-07-27 21:18:15 -04:00
parent 7c9afd8931
commit 581e5548d5
6 changed files with 249 additions and 84 deletions

View File

@@ -105,7 +105,7 @@ class Transportation(models.Model):
def clean(self):
if self.collection:
if self.collection.is_public and not self.is_public:
raise ValidationError('Transportations associated with a public collection must be public. Collection: ' + self.trip.name + ' Transportation: ' + self.name)
raise ValidationError('Transportations associated with a public collection must be public. Collection: ' + self.collection.name + ' Transportation: ' + self.name)
if self.user_id != self.collection.user_id:
raise ValidationError('Transportations must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Transportation owner: ' + self.user_id.username)